Previous Page: SecureLogin Commands  Next Page: SecureLogin Script Language

Commands

ChangePassword

Class

Click

Ctrl

Delay

Dialog / EndDialog

DisplayVariables

EndScript

If / Else /EndIf

IfText / EndIfText

Increment / Decrement

KillApp

MessageBox

Parent / EndParent

PickListAdd

PickListDisplay

ReadText

RegSplit

Repeat

RestrictVariable

RestrictVariable

Run

Strcat

Set

SetCursor

SetFocus

SetPlat

Setprompt

Title

Type

WaitForFocus

Waitfortext


ChangePassword

Usage: CHANGEPASSWORD variable [random]

Used in: Windows*, Terminal Launcher.

Command Type: Action

Arguments:

variable - A normal or run time variable that the new password is stored in.

[random] - If specified, invokes the random password generator.

Remarks:

The ChangePassword command allows for a single variable to be changed. Use this command in scenarios where password expiration is an issue. The variable passed in will be set to the new password.

The flag for this command is "random." If the "random" flag is set, the user will not be prompted and the password will be generated automatically, based on the platform's password policy.

If the "randomness flag is not selected, SecureLogin displays a dialog box, prompting the user to enter a new variable. SecureLogin then ensures that the new variable complies with any password policies that may apply.

For more information on password policies, see RestrictVariable.


Example Terminal Launcher Script

restrictvariable $Password "password policy script"
waitfortext "Enter USERID"
type $Username
type @E
waitfortext "Enter Password"
type $Password
type @E
repeat 100
iftext "User logged in successfully"
break
endiftext
iftext "Password expired"
changepassword $Password random
type @T
type $Password
type @T
type $Password
type @E
break
endiftext
delay 50
endrepeat


Class

Usage: CLASS window-class

Used in: Windows

Command Type: Dialog specifier

Arguments:

window-class- A string specifying the window class that this statement will match.

Remarks:

When a window is created, it is based on a template known as a window class. The CLASS statement checks to see if the class of the newly created window matches its <window-class> argument. If so, execution continues on the next line. Otherwise, the dialog statement does not match and execution continues at the next dialog statement.

The class can be determined by using Window Finder. See Finding Dialog Control IDs.


Example Windows Script

Dialog 
class "Button"
title "&OK"
Parent
Title "Password Verification" 
Parent
Title "XXXXXX"
class "#32770"
EndParent
type "$Password" #1159 password 
EndParent
EndDialog
type "\N "

repeat 100
if ?count eq 15
type -raw "hello world"
set ?count <NOTSET> 
endscript
endif
increment ?count
delay 40
endrepeat


Click

Usage: CLICK ctrl-ID flag x y

Used in: Windows

Command Type: Action

Arguments:

ctrl-ID - The dialog ID of the button to be clicked.

[-raw] - Eliminates the mouse and sends a direct click.

Remarks:

The Click command sends a click command to the button passed in as the argument. If the button does not return a #ID, use Type "\n".

If a control does not respond to the click command, the flag -raw can be passed in. This procedure causes SecureLogin to emulate the mouse and send a direct click message to the control. When you set the #ID to 0, SecureLogin sends the Click command to the window that the script is running on. Also, you can set an X and Y coordinate. The coordinate is relative to the client area of the application, not the screen.

Click #1

Click #0 -raw -x 10 -y 15


Example Windows Script

Dialog 
Title "Sign On" 
EndDialog 
PickListAdd User1 Tim
PickListAdd Admin 
PicklistDisplay ?User "Please Select your user account"   noedit
SetPlat "?User"
WaitForFocus #105 
changepassword "$Username" random
type "$Username"
delay 200
Click #107 -raw -x 10 -y 3
type "$Password" 
type "\Alt+s"

NOTE:  The PicklistDisplay line ends with noedit; noedit is not a separate line.


Ctrl

Usage: CTRL <ctrl-id> [<regex>]

Used in: Windows

Command Type: Dialog specifier

Arguments:

ctrl-ID - The dialog ID of the control to be checked.

<text> - (Optional) The regular expression to match against the control's text.

Remarks:

The Ctrl command checks that the window contains a certain control. This command takes a #ID argument. The #ID is the control ID of a certain control. This number is associated with the control at the time the program is compiled and is constant.

NOTE:  This number may change between versions of the third-party software

To determine this number, you can use Window Finder. (See Finding Dialog Control IDs.) If the control is not found, the script skips to the next Dialog statement.


Example Windows Script

Dialog 
Title "Enter Network Password" 
Ctrl #1218 
Ctrl #1041
Ctrl #1 
Setplat #1041 "(.*)"
EndDialog 
Type "$Username" #1218
Type "$Password" #1219
Click #1
Setprompt "Enter your userid and password for this web site"


Delay

Usage: DELAY period

Used in: Windows, Terminal Launcher

Command Type: Action

Arguments:

period - A time period, in milliseconds, to pause execution for.

Remarks:

The Delay command delays the action of the script for the time specified. The time is in milliseconds. This delay is in case an application happens to have an introduction screen or some other custom feature. If a script does not work the first time, adding a delay should be your first action. (For example Delay 5000 will cause a pause for 5 seconds).


Example Windows Script

Dialog
Title "Oracle Applications"
Class "AwtFrame"
Delay 2000
EndDialog
delay 2000
Type "$UserName"
delay 800
Type "\N"
Delay 400
Type "$Password"
Type "\N"


Dialog / EndDialog

Usage: Dialog

Usage: EndDialog

Used in: Windows

Command Type: dialog specifier

Arguments: None

Remarks:

The Dialog command identifies the beginning of the dialog block. The Dialog/EndDialog statement is used to construct a dialog specifier block that consists of a series of dialog specifier statements (for example, Ctrl, Title).

When a Dialog/EndDialog block is executed, the block executes each of the dialog specifier statements in turn. If the statement succeeds, execution continues. If a statement fails, the whole dialog/EndDialog block fails and execution skips to the next Dialog/EndDialog block, if any.

The EndDialog command identifies the end of a dialog block. The script that follows the EndDialog command is called the script body. Another Dialog statement or the end of the script terminates the script body.


Example Windows Script

Dialog 
Title "Enter Network Password" 
Ctrl "#1218" 
Ctrl "#1" 
EndDialog 
if ?aaa eq "firstrun"
set ?aaa "blank"
endscript
else
set ?aaa "firstrun"
endif
Type "$Username"#1218
Type "$Password"#1219
Click #1


DisplayVariables

Usage: DISPLAYVARIABLES

Used in: Windows, Terminal Launcher

Command Type: Action

Arguments: None

Remarks:

The DisplayVariables command displays a dialog box for the user. This box lists all the user's variables for the current platform. The variables can then be edited to contain their correct values.

For example, if the login is unsuccessful due to an incorrect username or password, the user can be prompted to change these values and continue the login process.


Example Terminal Launcher Script

waitfortext login
SetPrompt "Enter Username"
type $Username
type @E
SetPrompt "Enter Password"
type $Password
type @E
delay 2000
repeat 100
iftext "Login incorrect"
messagebox "Your Username or Password Is Invalid"
displayvariables
type $username
type @E
type $password
type @E
endif


EndScript

Usage: EndScript

Used in: Windows, Terminal Launcher

Command Type: Action

Arguments: None

Remarks:

Immediately terminates execution of the script.


Example Windows Script

restrictvariable ?newPassword "Default Policy"
dialog
class UniCanvas
delay 200
ctrl #8269760
enddialog
endscript
dialog
class UniCanvas
ctrl #8263376
ctrl #8264816
ctrl #8265984
enddialog
SetPlat "?user"
type $password 
type \t
changepassword ?newPassword random 
type ?newPassword 
type \t
type ?newPassword 
delay 1500
type \Ctrl+a
Set $password ?newPassword
dialog
class UniCanvas
delay 200
ctrl #8262512
enddialog
SetPrompt "Enter Username"
type $username #8261552
type $username #8260304
SetPrompt "Enter Password"
delay 500
type $password
type "\n"
SetPrompt "Please enter your Login Details"


If / Else /EndIf

Usage: If operator

Usage: Else

Usage: EndIf

Used in: Windows

Command Type: Flow control

Arguments:

operator

- gt The left value is greater than the right value.

- eq - The two values are equal.

- lt - The left value is less than the right value.

-text - Provides a shortcut to evaluating text of windows.

Remarks:

The If command establishes a block to be executed if the operator is found to be true.

The Else command works inside an IF block as the script block to execute if the operator evaluates False. The EndIf command is used to terminate the IF block.

The operator eq allows two pieces of data to be compared.

As the following script illustrates, the first argument must be a variable. The second can be any variable or string.

If ?result eq "Yes"
#do something
else
#do something else
Endif

As the following script illustrates, the operator -text argument works as a shortcut to evaluating text of windows.

If -text "Enter Details" #1045
#do something
else
#do something else
Endif


Example Script Section

if ?aaa eq "firstrun"
set ?aaa "blank"
endscript
else
set ?aaa "firstrun"
endif

# check the version of SecureLogin is greater than v2.3.08
if ?SYSVERSION lt 2308
   messagebox "This version of SecureLogin does not support
   the necessary commands"
   endscript 
endif

For a list of internal variables that can be used in the SecureLogin script language, see Substituting Variables.


IfText / EndIfText

Usage: IfText watch-text EndIfText

Used in: Terminal Launcher

Command Type: Flow control

Arguments:

watch-text - The text to check for.

Remarks:

The IfText command does a case sensitive search of the current terminal window for watch-text. If the text is found, the execution continues to the next line. Otherwise, execution jumps to the statement following the matching EndIfText command. IfText/EndIfText blocks can be nested.

If the text specified in the IfText statement can be found, the IfText command causes Terminal Launcher to execute all of the commands following it until Terminal Launcher reaches the corresponding EndIfText command. Each IfText command must be matched by a corresponding EndIfText command.

These blocks can be placed within each other. It is also useful to place repeat loops around IfText blocks.

The IfText command is mainly used for password changes in terminal applications.


Example Terminal Launcher Script

WAITFORTEXT "Enter USERID"
TYPE $Username
TYPE @E
REPEAT 100
IFTEXT "password"
TYPE $Password
TYPE @E
BREAK
ENDIFTEXT
IFTEXT "USERID Expired"
MESSAGEBOX "Your USERID has expired. Please contact the helpdesk."
ENDSCRIPT
ENDIFTEXT
DELAY 50
ENDREPEAT
REPEAT 100
IFTEXT "User logged in successfully"
ENDSCRIPT
ENDIFTEXT
ENDREPEAT


Increment / Decrement

Usage: Increment ?variable

Usage: Decrement ?variable

Used in: Windows

Command Type: Flow control

Arguments:

?variable - The name of the run time variable used to control the count process.

Remarks:

The Increment and Decrement commands are used for flow control to count the number of passes a particular script has made. After the number of instances being checked for has been reached, the script can be instructed to run another task or end the script.

This instruction can be particularly useful in the following situations:


Example Windows Script

Dialog 
class "Button"
title "&OK"
Parent
Title "Password Verification" 
Parent
Title "XXXXXX"
class "#32770"
EndParent
type "$Password" #1159 password 
EndParent
EndDialog
type "\N "repeat 100
if ?count eq 15
type -raw "hello world"
set ?count <NOTSET> 
endscript
endif
increment ?count
delay 40
endrepeat


KillApp

Usage: KillApp process-name

Used in: Windows, Terminal Launcher

Command Type: Flow control

Arguments:

process-name - The name of the process to stop.

Remarks:

You can use the KillApp command to kill an application that did not close successfully since the last time it was run.


Example Windows Script

dialog
ctrl #1218 
ctrl #1219
ctrl #1041
setplat #1041 "(.*)"
enddialog
if -text "" #1218
type $username #1218
type $password #1219
click #1else 
if ?runCount eq "<NOTSET>"
set ?runCount "0"
endifif ?runCount eq "2"
MessageBox "You have entered the wrong details, please contact administrator"
KillApp "iexplore.exe"
endscript
endifdisplayvariables "Please Re-Enter Your Login Details"
type $username #1218
type $password #1219
click #1

if ?runCount eq "0"
set ?runCount "1"
endscript
endifif ?runCount eq "1"
set ?runCount "2"
endscript
endif


MessageBox

Usage: MessageBox flag ?variable data [data]

Used in: Windows, Terminal Launcher

Command Type: Action

Arguments:

flag - The -yesno flag allows the user to select either Yes or No instead of clicking the OK button.

?variable - This run time variable can be used to produce a result for the -yesno flag.

data - The text to be displayed to the user.

Remarks:

The MessageBox command pops up a graphical box with text that is passed in. The script is suspended until the user reacts to this message. As the following line illustrates, the MessageBox command can take any number of text arguments, including variables.

MessageBox "The User" $Username "has just been logged into the system"

A -yesno flag can also be set when calling a MessageBox. If this flag is set, MessageBox prompts the user with a box that has a Yes and No button rather then OK. As the following line illustrates, passing in a run time variable can capture the result of this box immediately after the flag.

MessageBox "Do you wish to continue?" -yesno ?result

This option sets the value of ?result to Yes if the user clicked Yes and to No if the user clicked No.


Example Windows Script

Dialog 
Title "ANR Login Panel" 
Ctrl "#1010" 
Ctrl "#1030" 
EndDialog 
Type "$Username" "#1010"
Type "$Password" "#1030"
Type "\N"
Delay 5000
iftext "Login incorrect"
messagebox "Login Incorrect. Updates Login Details Now?" -yesno ?result
If ?result eq yes
displayvariables
Type "$Username"#1010
Type "$Password"#1030
Type "\N"
Else
KillApp "anr32.exe"
Break


Parent / EndParent

Usage: Parent

Usage: EndParent

Used in: Windows

Command Type: Flow control

Arguments: None

Remarks:

The Parent command begins a Parent Statement that contains information about the window's parent. The commands that follow work the same in a parent block as they do in a dialog block. If they evaluate to False, the script ends. However the commands query the parent window.

For example, the Title command in a parent block returns False if the title of the parent does not match the one specified in the command.

Parent blocks, however, do not skip to the next parent block like a dialog block does. Instead, it immediately returns the error to the dialog block, and the dialog block then continues to the next dialog block or ends if no more dialog blocks exist.

As the following lines illustrate, the Parent command can also be nested:

  Dialog
  Parent
  Parent
  Title "Login"
  EndParent
  EndParent

This nesting allows SecureLogin to check the parent of the parent.

As the following script illustrates, you can also use the Parent command to set the subject of the script to the parent window, allowing use of the other commands such as Type and Click.

  Dialog
  Title "Login"
  EndDialog
  Type "$username"
  Parent
  Click #24
  EndParent
  Click #4

If the Parent command is used on a window that has no parent, the Script block breaks. The block then skips to the next dialog block or ends if no more blocks exist.

The EndParent command terminates a Parent block and sets the subject of the script back to the original window.


PickListAdd

Usage: PickListAdd display-text return-value

Used in: Windows

Command Type: Action

Arguments:

display-text - The text that will be displayed in the picklist for the specified option.

return-value - The value returned from the picklist.

Remarks:

The PickListAdd command allows users who have multiple accounts for a particular system to choose which accounts they use to log in with. It can also be used for users who have one Mainframe account, with multiple sessions to choose from.

The PickListAdd command adds a variable to this list for the user to pick from. The first string passed in is the display-text. This is the text as it is displayed in the picklist. The second string is the return-value that is supplied from the PickListDisplay command.

If the second string is not passed in, the display-text is returned.

The following script will display AdminUser and User1 when PickListDisplay is called.

PickListAdd AdminUser cn=administrator
PicklistAdd User1 cn=tim

For more information on the PickListDisplay command, see PickListDisplay.


Example Terminal Launcher Script

PICKLISTADD "Open ISPF" "ispf"
PICKLISTADD "TSO"
PICKLISTDISPLAY ?app "Please select which application you
would like to log in to." noedit
waitfortext USERID
type $Username
type @E
waitfortext Password
type $Password
type @E
waitfortext "Enter command"
type ?app
type @E


PickListDisplay

Usage: PickListDisplay ?variable display-text flag

Used in: Windows

Command Type: Action

Arguments:

?variable - The output variable for the selected option.

display-text - The description text for the picklist box.

flag - The noedit flag prevents users from adding variables.

Remarks:

The PickListDisplay command displays the list of options built by previous calls to PickListAdd. PickListDisplay then returns the result in a variable passed into the command. If none of the displayed entries are the desired account, users can enter their own data in an edit field at the bottom of the picklist.

As the following line illustrates, you can turn off this feature by setting the noedit flag:

PickListDisplay ?result "Please Pick your user" noedit


Example Script Section

PICKLISTADD "option 1" value1
PICKLISTADD "option 2" value2
PICKLISTDISPLAY ?sel1 "Please choose an option from this first
picklist box"
PICKLISTADD "option 1b" value1b
PICKLISTADD "option 2b" value2b
PICKLISTDISPLAY ?sel2 "Please choose an option from this second picklist box" noedit


ReadText

Usage: (Windows Type) ReadText #ID variable

Usage: (Terminal Launcher Type) ReadText variable column-number start-position character-number

Used in: Windows, Terminal Launcher

Command Type: Action

Arguments:

#ID - The control ID of the text to be read.

variable - The variable that will receive the text that is read.

column-number - The column number to begin the read from.

start-position - The position number of the first character to be read.

character-number - The number of characters to be read.

Remarks:

The ReadText command runs in both Windows and Terminal Launcher type scripts. Although the arguments for each type are different, the result of each command is the same.

In a Windows script, the ReadText command reads the text from any given Control ID and passes it to the specified variable. For this command to function correctly, the Control ID of the text being read must be valid.

In the Terminal Launcher script, the ReadText command reads in a specified number of characters, starting at a given point, and passes the characters to the variable.


Example Terminal Launcher Script

WAITFORTEXT "USERID
TYPE @0
TYPE $userid
TYPE @T
TYPE $password
TYPE @E
Delay 250
If -Text "TSO/E LOGON"
Delay 250 
ReadText ?TSOMsg 3 2 1 
If ?TSOMsg eq "IKJ"
Else
TYPE @0
TYPE $password
TYPE @E
EndIf


RegSplit

Usage: RegSplit regex input-string output-string1 output-string2

Used in: Windows

Command Type: Action

Arguments:

regex - the regular expression

input-string -

output-string1

output-string2

Remarks:

The RegSplit command allows a string to be split by using a regular expression. This command is similar to Setplat's regular expression feature. Output string1 contains the first sub-expression, OutPut string2 contains the second sub-expressions, and so on

The following illustrates the RegSplit command:.

Regsplit "The user (.*) has logged into the system at (.*)" "The user Tim has logged into the system at 204.223.245.2" ?name ?system.

Now the variable ?name will contain "Tim" and the variable system will contain 204.223.245.2.


Example Windows Script

dialog
title "Username and Password Required"
ctrl #331
ctrl #214
ctrl #330
enddialog
readtext #331 ?text
regsplit "Enter username for (.*) at (.*):" ?text ?realm ?site
index ".bt.com"?site ?position
if ?position eq "0"
endscript
endif
strcat ?platform ?site " - " ?realm
setplat ?platform
type #214 $username
type #330 password
click #1

NOTE:  The line beginning with "regsplit" ends with "?site."


Repeat

Usage: Repeat loops

Used in: Windows, Terminal Launcher

Command Type: Action

Arguments:

loops - The number of repeat associated with a script block.

Remarks:

The Repeat command establishes a script block similar to the If command. The repeat block is terminated by an EndRepeat command and can be broken out of by use of the Break command. The loops argument is the number of times the block is to be repeated before continuing on in the script.


Example Terminal Launcher Script

waitfortext login
SetPrompt "Enter Username"
type $Username
type @E
repeat 1000
iftext "Password"
delay 200
SetPrompt "Enter Password"
type $Password
type @E
delay 2000
repeat 100
iftext "Enter login password"
type $Password
type @E
WaitForText "New password"
changepassword $Password 
type $Password 
type @E
waitfortext "Re-enter new password"
type $Password 
type @E
waitfortext "passwd successfully changed"
set ?tempPassword $Password
break
endiftext


RestrictVariable

Usage: RestrictVariable variable-name password-policy

Used in: Windows, terminal Launcher

Command Type: Action

Arguments:

variable-name - The name of the variable to restrict.

password-policy - The name of the policy to restrict the variable.

Remarks:

The RestrictVariable command monitors a variable and enforces a specified password policy on that variable.

For more information on the RestrictVariable command, see Using Password Policies.


Example Terminal Launcher Script

restrictvariable $Password passpolscript
waitfortext USERID
type $Username
type @E
waitfortext password
type $Password
type @E
repeat 1000
iftext "password expired"
changepassword $Password random
type ?Password
type @E
waitfortext "confirm new password"
type ?Password
type @E
break
endiftext
iftext "User logged in successfully"
break
endiftext|
delay 10
endrepeat


Run

Usage: Run command [arg1 [arg2] [.]

Used in: Windows, Terminal Launcher

Command Type: Action

Arguments:

command - The full path to the command to be executed.

arg1, arg2 - A list of arguments to the command.

Remarks:

The Run command starts the program specified in <command> and then uses the specified arguments. The script does not wait for the launched program to complete.


Example SecureLogin Startup Script

MessageBox "Good Morning" "%CN" "Would You Like To Start Notes Now?" -yesno ?Result
If ?Result eq yes
Run "c:\lotus\notes\notes.exe"
Else
EndScript


Strcat

Usage: Strcat variable input-string1 input-string2

Used in: Windows

Command Type: Action

Arguments:

variable - The regular expression.

input-string1 - The first data string or variable.

input-string2 - The second data string or variable.

Remarks:

The Strcat command copies one piece of data onto the end of another piece of data.

For example, you include the following line in a script:

STRCAT ?result SecureRemote $username

When $username is Tim, the ?result contains "SecureRemote Tim".


Example Script

dialog
title "Username and Password Required"
ctrl #331
ctrl #214
ctrl #330
enddialog
readtext #331 ?text
regsplit "Enter username for (.*) at (.*):" ?text ?realm
?site
index ".bt.com" ?site ?position
if ?position eq "0"
endscript
endif
strcat ?platform ?site " - " ?realm
setplat ?platform
type #214 $username
type #330 password
click #1

NOTE:  The line beginning with "regsplit" ends with "?site".


Set

Usage: Set variable data

Used in: Windows

Command Type: Action

Arguments:

variable - The variable being assigned to.

data - The text or variable being read from.

Remarks:

The Set command copies the value of data into variable. The data argument can be any text or another variable. However, the variable argument must be either ?variable or $variable.


Example Windows Script

RestrictVariable ?newPassword "Default"
Dialog
Title "Lotus Notes"
set ?PasswordExpired "FALSE"
Ctrl #65535 "WARNING: Your password will expire on"
EndDialog
set ?PasswordExpired "TRUE"
MessageBox "hello"
Dialog
class "#32770"
ctrl #17 "Set &Password..."
EndDialog
if ?PasswordExpired eq "TRUE"
changepassword ?newPassword random
set $newPassword ?newPassword
click #17
set ?PasswordExpired "FALSE"
endif
MessageBox "Hello"
Dialog
Title "Set Password"
EndDialog
type ?newPassword #1005
click #1


SetCursor

Usage: SetCursor screen-offset

Used in: Terminal Launcher

Command Type: Action

Arguments:

screen-offset - The position to which the cursor should be moved.

Remarks:

The SetCursor command sets the cursor to a particular position. The position number must be a number greater than 0 (for example SETCURSOR 200). If the screen position is invalid, Terminal Launcher displays an error message.


Example Terminal Launcher Script

waitfortext "Userid"
setprompt "Please enter your mainframe login name"
type $USERNAME
type @T
setprompt "Please enter your mainframe password" password
type $password
type @Ewaitfortext "MAIN MENU" 
setcursor 2415
type "start Session A"
type @E


SetFocus

Usage: SetFocus #ID

Used in: Windows

Command Type: Action

Arguments: None

Remarks:

The SetFocus command gives the keyboard focus to a specified Control ID.

For the SetFocus command to function correctly, the Control IDs that are specified must be valid.


Example Windows Script

Dialog 
Title "Acct Statement Login"
Ctrl "#160"
Crtl "#170"
Class "DialogClass32"
EndDialog 
Delay 500
SetFocus "#160"
SetPrompt "Enter UserName"
Type "$Username" "#160"
Type "\N"
SetPrompt "Enter Password"
Type "$Password" "#170"
Click #4
SetPrompt "Please Enter Your Login Details For The Acme Accounting System"


SetPlat

Usage: SetPlat platform-name

Usage: SetPlat regex #ID

Used in: Windows, Terminal Launcher

Command Type: Action

Arguments:

platform-name - The platform name to read the variables from.

regex - A regular expression to be used as the platform name.

#ID - The control ID of the regular expression to be used.

Remarks:

The SetPlat command changes the platform that variables are read and saved to. If an application has a password in common with another application, instead of the user entering it twice you can SetPlat "Second platform". SecureLogin then switches the script engine to read variables to the other platform. If the platform does not exist, it will be created.

SetPlat can also take a #ID to read from and support regular expressions.

For example, the following figure illustrates a standard dialog box for accessing a password-protected site using Netscape* Navigator.


Screen Capture: A Dialog Box for Accessing a Password-Protected Web Site

The following script illustrates a simple way to sign in to this site, using a platform called netscape.exe:

Window "Username and Password Required"
  Type $username #214
   Type $password #330
  Click #1

However, this script limits users to one username/password combination for all http-authentication Web sites accessed through Netscape. Such a limitation poses a significant problem.

Notice that the dialog box pictured above always uses the same format of text, which contains the name of the Web site to sign in to. The solution to this problem is to use a dialog block with a SetPlat statement similar to the following:

Dialog
   Title "Username and Password Required"
   Ctrl #330
  Ctrl #214
  Ctrl #331
  Ctrl #1
  Ctrl #2
  Setplat #331 "Enter username for .* at (.*):"
Enddialog
Type $username #214
Type $password #330
Click #1

The power of this script is in the following line:

Setplat #331 "Enter username for .* at (.*):"

The script first reads the following line from dialog control ID 331:

Enter username for Control Panel at www.serversystems.com:

The script then applies the regular expression to this text. Regular expressions are a powerful way to manipulate text strings. However, for most purposes a few very basic commands will suffice:

Basic Command Action

. (a period)

Matches any character

* (an asterisk)

Matches zero or more of the proceeding character

() (parentheses)

Makes the contents of the parentheses a sub-expression

The text matched inside the parentheses then becomes the symbol platform. In the preceding example script, after the user has run the script you will see the username and password saved under www.serversystems.com.


Screen Capture: A Sub-Expression Displayed in Login Details

If a dialog control ID is not specified to Setplat, the symbol platform will be unconditionally be changed to the platform specified in <regular-expression>. An unconditional Setplat command is only valid if specified before dialog/enddialog statements.

For more information on the SetPlat command, refer to PickListAdd.


Setprompt

Usage: Setprompt prompt-text

Used in: Windows, Terminal Launcher, Web

Command Type: Action

Arguments:

prompt-text The information displayed at the top of the prompt variable box.

Remarks:

The SetPrompt command customizes the text in the variable boxes used when prompting for new variables or when DisplayVariables command is used.

To replace the text at the top of the box, place the SetPrompt command at the very bottom of the script.

To replace the text next to any variable in a box, place the SetPrompt command immediately before the variable in the script.


Example Windows Script

Dialog 
Title "Login" 
Ctrl "#1060" 
Ctrl "#1061" 
EndDialog 
SetPrompt "Enter UserName"
Type "$Username"#1060
SetPrompt "Enter Password"
Type "$Password"#1059
Click #1061
SetPrompt "Please Enter Your SecureRemote Login Details"


Title

Usage: Title window-title

Used in: Windows

Command Type: Dialog specifier

Arguments:

window-title - The text to test against the window title.

Remarks:

The Title command retrieves the title of the window and compares it against the string passed in as the argument. For this section of the script to run, the two must match.

The following line illustrates the Title command:

Title "Secure Remote Login"

You can use Window Finder to locate the window title. See Finding Dialog Control IDs.


Example Windows Script

Dialog 
Title "SecureRemote Login" 
Ctrl "#1060" 
Ctrl "#1061" 
EndDialog 
Type "$Username"#1060
Type "$Password"#1059
Click #1061


Type

Usage: Type flag text [ctrl-ID]

Used in: Windows, Terminal Launcher, Web

Command Type: Action

Arguments:

flag - "-raw" (Only available when not using Control IDs)

text - The text to type into this area.

ctrl-ID - The dialog ID of the control to be checked.

Remarks:

The Type command is the command that tells SecureLogin to type something into a window. The first argument is text. It is simply a string enclosed in quotation marks (" "). The ctrl-ID argument is the identifier of the control that the text is to be typed into.

NOTE:   If the ctrl-id is not specified, SecureLogin will send keystrokes to the control that currently has focus. This can be useful if a special control needs to be typed into. SecureLogin provides custom keys for Tab and Enter. The script parser interprets these escape sequences at run time.

This command is used to enter data, such as username and passwords, into windows. It can take a #ID as an argument after the data to enter. If the #ID is passed in, the information is sent directly to the window. If no #ID is passed in, SecureLogin emulates the keyboard directly and sends individual keystrokes.

The flag for the Type command is -raw. It is only supported when you don't use the Control ID. By default, when you enter data into a window, SecureLogin verifies that the windows exists, before continuing the script. This checking is disabled when the -raw flag is set, causing SecureLogin to log in to whatever window has focus. This can be useful if you need to use a delay after a step in the login process, and need to enter data after this delay.

For example, the Type command can be used to submit Command keys to an application that requires the Alt and L keys to be pressed.

For more information on Type commands, see Windows and Internet Keystroke Commands.


Example Windows Script

Dialog
Title "Lotus Notes"
CTRL #65535 "WARNING: Your password will expire on (.*)"
EndDialog
set ?PassExpired "YES"
click #2
Dialog
 title "HPInboxHeader"
 class "NotesSubprog"
EndDialog
if ?PassExpired eq "YES"
 # Select File, Tools, User ID, Set Password.
 Type "\Alt+F"
 Type "T"
 Type "I"
 Type "P"
EndIf
Dialog
title "Set Password"
ctrl #311 "Enter your new password:"
EndDialog
if ?RunSETPWDBefore eq "YES"
 Type ?Napes #301
 Set ?RunSETPWDBefore "NO"
 Click #1
 Set $Password ?NewPass
 EndScript
endif
ChangePassword ?NewPass random
Type ?NewPass #301
Click #1
Set ?RunSETPWDBefore "YES"
Dialog
Title "Lotus Notes"
ctrl #65535 ""You have used this password before. Please
choose a new one"
EndDialog
Set ?RunSETPWDBefore "NO"


WaitForFocus

Usage: WaitForFocus ctrl-ID repeat-loops

Used in: Windows

Command Type: Action

Arguments:

#ID - The control ID of the box to wait for.

repeat-loops - The number of repeat loops that will run.

Remarks:

The WaitForFocus command suspends the running of the script until the control has received keyboard focus or until the repeat loops expire. The repeat-loops argument is an optional value that defines how many loop cycles to wait. The value defaults to 3000 loops if nothing is set. As soon as focus is received, the script continues.

As the following line illustrates, you can set the repeat loop to never expire by setting the value to a negative number:

WaitForFocus "#1065" "-1"

If the Control ID is set to 0, it will loop until the window defined in the Dialog / EndDialog statement is given keyboard focus.

NOTE:  Do not place WaitForFocus commands within Dialog / EndDialog statements.


Example Windows Script

Dialog
Title "Login"
Class "#32770"
Enddialog
WaitForFocus #600 
delay 200
SetPrompt "Enter Username"
Type $Username
Type \t
SetPrompt "Enter Password"
Type $Password 
delay 500
type \n
Dialog
Title "Login Error"
EndDialog
MessageBox "The username or password you have entered are
incorrect"
displayvariables
Click #1
SetPrompt "Please Enter your context Login details"


Waitfortext

Usage: Waitfortext text

Used in: Terminal Launcher

Command Type: Flow control

Arguments:

text - The text to wait for.

Remarks:

The Waitfortext command causes Terminal Launcher to wait for the specified text to be displayed before continuing. This command is essential because the user will always want to wait for a particular text to be displayed on the screen before continuing. Otherwise, text may be typed too soon.

The text that users wait for may appear anywhere on the terminal screen. The text is case sensitive. If the text is written in the wrong case, Terminal Launcher waits on that screen until it times out, unable to find the correct text.


Example Terminal Launcher Script

restrictvariable ?newPassword "Default Policy"
waitfortext login
SetPrompt "Enter Username"
type $Username
type @E
Set ?tempPassword $Password
repeat 1000
iftext "Password"
delay 200
SetPrompt "Enter Password"
type $Password
type @E
delay 2000
repeat 100
iftext "Enter login password"
type $Password
type @E
WaitForText "New password"
changepassword $Password 
type $Password 
type @E
waitfortext "Re-enter new password"
type $Password 
type @E
waitfortext "passwd successfully changed"
set ?tempPassword $Password
break
endiftext



  Previous Page: SecureLogin Commands  Next Page: SecureLogin Script Language