background image
<< Using Filters to Open SQA Basic Files | The Template File >>
<< Using Filters to Open SQA Basic Files | The Template File >>

Example Script

Adding Features to GUI Scripts
3-18
Header and Library Source File Examples
The following examples show how a script can reference:
Variables and constants declared in a header file.
Procedures declared in the header file and defined in a library source file.
To run the example, type the contents of each example file into an empty .rec script
file, .sbh header file, and .sbl library source file. Before attempting to run the script,
save the .sbh file and compile the .sbl file.
The examples and the names you should assign the files are:
Example Script Assign any name to this script.
Example Header File Name the script tstHeader.sbh
.
Example Library Source File Name the script tstLibrary.sbl
.
Example Script
Run this example with the example library and header files:
'$Include "tstHeader.sbh"
Option Explicit
Sub Main
'Initially Recorded: 01/17/00 18:12:16
'Script Name: testscript
userInput = InputBox("Type a number:
")
Call compareNumbers(userInput,NMBR)
End Sub
Example Library Source File (Tstlibrary.sbl)
Run this example with the example script and header files. Be sure to compile the
library source file to an .sbx file before you run the script that calls the custom
procedure defined in the library file:
Sub compareNumbers(inputVal as Integer, constVal as Variant)
Dim txt as String
If inputVal > constVal then
txt="You typed a number greater than "
ElseIf inputVal < constVal then
txt="You typed a number less than "
Else
txt="The number you typed equals "
End If
MsgBox txt + constVal
End Sub
NOTE: These examples are also provided in the Robot Help. (See header files in
the Help Index.) You can copy the examples from the Help into your own files.