PixieRobot: WWW Help


PixieRobot now provides a script interface for driving a browser object.  You can script:


Programming a conversation: in brief
Scripts are plain text files written in the VBSCRIPT language.  By default the browsing script is called "onInterval.txt"
but you can change its name with entries like this in "PixieRobot.ini", section "[WWW]":
ScriptOnInterval=Cleopatra.txt

You need to name your master routine
Sub Main

The script statement  Monitor=True
causes the conversation to be made visible. 
Monitor=True should always be the first line in a new Sub Main.
Change to Monitor=False when you "go production".

You then script one step at a time, test-running with Menu:WWW --> Immediate  (Hotkey = F7).
At each step the monitor, which is built with objects from "Internet Explorer", displays the result. 
Click the "WriteToFile" button to save the current page for further inspection.
For a faster way to work, you can right-click on the displayed page area, then select "View Source" from the popup menu.

Most commonly-used library functions of those we have added to VBSCRIPT:
ExecuteWWW, a function used for navigation and form submission.
XForm, an object, consisting of the collection of elements in the first page form. Mostly used for data entry into pages, but also for using the "document object model" for scraping desired data out of a target page.


Scripting
Scripts are plain text files written in the VBSCRIPT language.  The language manual is published at
http://msdn.microsoft.com/scripting
but that is a rather dry theoretical document.  We aim here to cover common PixieRobot by example.

Features and points of our implementation

General VBSCRIPT note:

  IW (Internet WWW Object): details of the scripting properties and methods
Grouped by purpose, all keywords and file/path strings are case-insensitive.

Call ExecuteWWW( URL, [PostData], [EndOfTx]  )
stringData = ExecuteWWW( URL, [PostData], [EndOfTx] )
Navigate to a page, or submit a form by using "SUBMIT" as the URL argument

Part

Description

Url

String: Address to navigate to, OR command "SUBMIT"

PostData

String: Optional data to submit in low-level formatlike"name=Michael&age= 37".

EndOfTx

String: Optional text to recognise as end of transmission.  This is a bandwidth-saving device so when this text arrives in the page download, PixieRobot knows that it has received all that you need and can stop further downloading.  Use distinctive text from near the end of the page.

 

XForm(FieldNameOrIndex  ) [(ArrayIndex)].Value = Value
Call XForm( FieldNameOrIndex
) .Click
Manipulate a form field directly through an abbreviation of the HTML Document Object Model
Note, this is equivalent to
WWW.Document.Forms(0).Elements(FieldNameOrIndex)[(ArrayIndex)].Value = Value
but it is much easier to type.  You may need the longer "official" version if you have more
than one form on a page, or if the page uses non-form-submission methods eg "remote scripting"
or "field-by-field".

Part

Description

FieldNameOrIndex

String or Integer: Field Name or Index to identify field to manipulate

ArrayIndex

Optional Integer, only needed when multiple fields have the same name

Value

Value for the field, usually string, but can be numeric, or for checkboxes, boolean =True/False

 

Call OutputToFile( Data, Destination ) 
Write string data as a disk file.  Very useful for logging results of scripting when developing scripts.

Part

Description

Data String to write to disk as data

Destination

String: full path of new file including file name

 

stringData = FileGetText(File_with_full_path_name)
Read contents of a file into stringData.  Useful for reading the contents of an attachment to feed into other systems like databases.  eg
stringData = FileGetText(PathAttachIn & AttachFile(Index))

Part Description
MessageString Message to log
Destination String: full path of new file including file name

 

LoggedMessage
String Property, returns the previous logmessage sent to the logfile and monitor.


Call LogMessage(Message)
Displays string Message on the PixieRobot Monitor, as well as writing it to its logbook.