Overview
Description:
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:
// 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 ('