Overview

Description:
A script is a set of instructions that AutoWeb uses to control your Web Browser (Internet Explorer). There are five basic parts of a script: Comments, Define Variables, Assignments, Flow Controls, and Functions. The parts you use in your script depend on what you wish to accomplish. A simple script may only use Functions to accomplish its purpose. Example 1 is a script that consists of only Functions. Example 2 is a script that contains all parts.

Comments:
Comments are strictly optional and serve no purpose other than to help you document the goal of your script and parts of your script. Any part of a script designated as a comment is completely ignored by AutoWeb. Comments are designated by '//' (two forward slashes together. Once AutoWeb encounters the Comment designation on a line, the remainder of the line is ignored. This means that Comments can be placed at the end of a line of script if desired.

Define Variables:
Variables are named memory locations that you can use to store and retrieve data within your script. Before a variable can be used in a script it must first be defined. Defining a variable tells AutoWeb what kind of data will be stored in it. (see Variable Types in the User Guide for more details). Usually Variables are defined at the beginning of a script.

Assignments:
Once Variables are defined, values can be assigned to them. Assignments are always made with an Equal Sign '='. The Variable on the left side of the Equal Sign is assigned the Value on the right side of the Equal Sign. Assignments can be simple or complex. Many assignments are made using the results of Functions on the left side of the Equal Sign.

Flow Controls:
Flow Controls are statements that determine which statements get executed. They control the flow of script execution. Flow Controls have conditions that are evaluated to see of they are TRUE or FALSE. Depending on the result a certain set of statements may be executed, or skipped, or repeated. AutoWeb flow controls are If/Else, For, and While. (see Controlling Script Execution for more details).

Functions:
Function are statements that perform some specific task. They usually have options that can be specified within parenthesis and are separated by commas. Most functions return a value that can be used in an assignment statement.

Example 1:
A simple example consisting of all Function statements. This example Opens the My Yahoo web page, logs on and then leaves the Browser open for the User.

OpenBrowser (TRUE)
GoToDocument ('my.yahoo.com')
SetFieldWithLabel ('Yahoo! ID:','JohnSmith')
SetFieldWithLabel ('Password:','cactus')
ClickButtonWithLabel ('Sign In')
DisconnectBrowser ()

Example 2:
A more complex example of the same functionality that takes into account the possibility that JohnSmith may already be logged on.

// Define User ID, Password and Text variables
string strUserID // 'str' in the variable name helps us remember that
string strPassword // these variables are strings
string strText

// Assign Values
strUserID = 'JohnSmith'
strPassword = 'cactus'

// Open Internet Explorer and go to My Yahoo
OpenBrowser (TRUE)
GoToDocument ('my.yahoo.com')

// See if the text 'Sign in to Yahoo!' exists on the page
strText = GetTextWithText ('
Sign in to Yahoo!')
// If the length of strText is greater than 0 then the text was found
If Len(strText) > 0 Then
 // Text was found, so log on
 SetFieldWithLabel ('Yahoo! ID:',strUserID)
 SetFieldWithLabel ('Password:',strPassword)
 ClickButtonWithLabel ('Sign In')
EndIf

// Disconnect AutoWeb from the Browser and leave it open for the User
DisconnectBrowser ()

Hosted by www.Geocities.ws

1