SQABasic Language Reference
Copyright
Contents
Preface
Audience
Other Resources
Accessing SQABasic Help
Using the Examples in Help
Notes About the Examples
Typographical Conventions
Contacting Rational Technical Publications
Contacting Rational Technical Support
Part I Introducing SQABasic
Chapter 1 What Is SQABasic?
Automatic Script Generation
Working with Test Scripts
Your Work Environment
Source and Runtime Files
SQABasic Additions to the Basic Language
Other Commands Not Found in Basic
VU Scripting Language
Chapter 2 Functional List
Arrays
Compiler Directives
Datapool Commands (SQABasic Additions)
Dates & Times
Declarations
Dialog Box Definition
Dialog Box Services
Disk and Directory Control
Dynamic Data Exchange (DDE)
Environmental Control
Error Handling
File Control
File Input/Output
Financial Functions
Flow Control
Numeric and Trigonometric Functions
Object Scripting Commands (SQABasic Additions)
Objects
ODBC
Screen Input/Output
SQABasic Commands
String Conversions
String Manipulation
Timing and Coordination Commands (SQABasic Additions)
User Action Commands (SQABasic Additions)
Utility Commands (SQABasic Additions)
Variants
Verification Point Commands (SQABasic Additions)
Part II Using SQABasic
Chapter 3 SQABasic Fundamentals
Commands
Arguments
Passing Arguments By Value or By Reference
Syntax of By-Value and By-Reference Arguments
Syntax for Passing Arguments to External Procedures
Passing Named Arguments
Syntax of Named Arguments
Data Types
Descriptions of SQABasic Data Types
Data Type Notes
Variant Data Types
Valid Variant Data Types
Identifying the Type of Data Stored in a Variant
User-Defined Data Types
Declaring a Variable as a User-Defined Data Type
Dialog Box Records
Data Type Conversions
Arrays
Declaring an Array
Referencing an Array
Dynamic Arrays
Dimensions of a Dynamic Array
Dynamic Array Example
Expressions and Operators
Numeric Operators
String Concatenation Operators
Comparison Operators
Logical Operators
Scope of Variables and Constants
Year 2000 Compliance
Suggestions for Avoiding Year 2000 Problems
Trappable Errors
Responding to Errors
User-Defined Errors
Error-Handling Examples
Chapter 4 SQABasic Scripts
What is a Script?
Script Source Files
Script Executable Files
Script Structure
Script Initialization
Window Restoration
Script Body
Script Close
Sample Script
User Action and Verification Point Commands
User Action Commands
Verification Point Commands
Syntax of User Action and Verification Point Commands
Components of a Recognition Method String
Recognition Method Order
Changing the Default Order
Recognition Methods in Java Commands
Using Object Scripting Commands with Java Objects
Specifying Parent Objects in recMethod
Object Context
Establishing Context through a Window Command
Actions that Set Context
Assigning Context to the Currently Active Window
Using Wildcards in Window Captions
Using Wildcard Characters as Ordinary Characters
Establishing Context through Context Notation
Using Wildcards in Window Captions
Using Wildcard Characters as Ordinary Characters
Default Context
Customizing Scripts
Script Editing Basics
Declaring Variables and Constants
Declaring Local Variables and Constants
Declaring Module-Level Variables and Constants
Declaring Global Variables and Constants
Adding Custom Procedures to a Script
Declaring a Procedure Residing in a Script
Declaring a Sub Procedure
Declaring a Function
Using a Procedure Definition as a Declaration
Example of a Custom Procedure
Adding Custom Procedures to a Library File
Working With SQABasic Library Files
Creating SQABasic Library Files
Editing SQABasic Library Files
Compiling SQABasic Library Files
Declaring a Procedure Residing in an SQABasic Library File
Where to Declare an SQABasic Library File
Working With DLL Files
Declaring a Procedure Residing in a DLL File
Where to Declare a DLL File
Using SQABasic Header Files
Creating and Editing a Header File
Creating and Editing a Project Header File
Saving SQABasic Header Files
Scope of Declarations in SQABasic Header Files
Declaring Global Variables and Constants Inside Header Files
Declaring Global Procedures inside Header Files
Referencing an SQABasic Header File
Sample Library and Header Files
SQABasic Path
Using the Template File
Chapter 5 Enhancements to Recorded Scripts
Object Scripting
Specifying an Object
Object Type
SQABasic Object Type Names
Object Context
Other Ways to Specify an Object
Specifying the Object Property
Properties Assigned in the Development Environment
Additional Properties
Array of Property Values
Specifying Individual Elements in an Array
Retrieving an Entire Array
Retrieving the Number of Elements in an Array
Getting Help Defining Recognition Methods
Letting Robot Define Recognition Method Values
Finding Recognition Method Values Programmatically
Examples
Object Scripting Status Codes
Managing Custom Verification Points
Summary of Verification Point Management Commands
Current Baseline and Logged Baseline
Actual Data Files
Using the Verification Point Management Commands
Example
Ownership of Custom Verification Point Files
Comparing Environment States
Why Compare Environment States?
What Environment State Changes Are Detected?
Using the Environment State Comparison Commands
When To Use the Environment State Comparison Commands
Specifying the Areas of the Environment To Test
Example of an Environment State Comparison
Displaying Messages in Robot
Displaying Messages in the Console Window
Displaying the Console Window
Writing to the Console Window
Removing Messages from the Console Window
Displaying Messages in the LogViewer
Using SQALogMessage
Using SQAScriptCmdFailure
Using Datapools
Summary of Datapool Commands
Using Datapools with GUI Scripts
Recording a GUI Script
Adding Datapool Commands to a GUI Script
Substituting Variables for Literal Values
Edit Box Example
Combo List Box Example
Assigning Datapool Values to Variables
Creating a Datapool
Finding Out What Data Types You Need
Finding Values in GUI Scripts
Example GUI Script
Accessing External Applications
Dynamic Data Exchange (DDE)
Opening a DDE Channel
Communicating with the Application
Closing the Channel
Objects
Step 1: Create an Object Variable to Access the Application
Step 2: Use Methods and Properties to Act on Objects
Part III Command Reference
Chapter 6 Command Reference
Abs
AnimateControl
AnimateControlVP
AppActivate
Asc
Assert
Atn
Beep
Begin Dialog...End Dialog
Browser
Button
ButtonGroup
Calendar
CalendarVP
Call
CallScript
CancelButton
Caption
CCur
CDbl
ChDir
ChDrive
CheckBox (Statement)
CheckBox (User Action Command)
CheckBoxVP
Chr
CInt
Class List
Clipboard
ClipboardVP
CLng
Close
ComboBox (Statement)
ComboBox (User Action Command)
ComboBoxVP
ComboEditBox
ComboEditBoxVP
ComboListBox
ComboListBoxVP
Command
Const
Cos
CreateObject
CSng
CStr
'$CStrings
CurDir
CVar
CVDate
DataWindow
DataWindowVP
Date (Function)
Date (Statement)
DateSerial
DateTime
DateTimeVP
DateValue
Day
DDEAppReturnCode
DDEExecute
DDEInitiate
DDEPoke
DDERequest
DDETerminate
Declare
Deftype
DelayFor
Desktop
Dialog (Function)
Dialog (Statement)
Dim
Arrays
Numbers
Objects
Strings
User-Defined
Variants
Dir
DlgControlID
DlgEnable (Function)
DlgEnable (Statement)
DlgEnd
DlgFocus (Function)
DlgFocus (Statement)
DlgListBoxArray (Function)
DlgListBoxArray (Statement)
DlgSetPicture
DlgText (Function)
DlgText (Statement)
DlgValue (Function)
DlgValue (Statement)
DlgVisible (Function)
DlgVisible (Statement)
Do...Loop
DoEvents
DropComboBox
DropListBox
EditBox
EditBoxVP
EndPlay
EndSaveWindowPositions
Environ
Eof
Erase
Erl
Err (Function)
Err (Statement)
Error (Function)
Error (Statement)
Exit
Exp
FileAttr
FileCopy
FileDateTime
FileLen
FileVP
Fix
For...Next
Format
Formatting Numbers
Formatting Dates and Times
Formatting Strings
FreeFile
Function...End Function
FV
GenericObject
GenericObjectVP
Get
GetAttr
GetField
GetLastVPResult
GetObject
Global
Arrays
Numbers
User-Defined
Strings
Variants
GoTo
GroupBox (Statement)
GroupBox (User Action Command)
GroupBoxVP
Header
HeaderVP
Hex
HotKeyControl
HotKeyControlVP
Hour
HTML
HTMLVP
HTMLActiveX
HTMLActiveXVP
HTMLDocument
HTMLDocumentVP
HTMLHidden
HTMLHiddenVP
HTMLImage
HTMLImageVP
HTMLLink
HTMLLinkVP
HTMLTable
HTMLTableVP
If...Then...Else
'$Include
InitPlay
Input (Function)
Input (Statement)
InputBox
InputChars
InputKeys
InStr
Int
IPAddress
IPAddressVP
IPmt
IRR
Is
IsDate
IsEmpty
IsMissing
IsNull
IsNumeric
JavaCanvas
JavaCanvasVP
JavaListView
JavaListViewVP
JavaMenu
JavaMenuVP
JavaObject
JavaObjectVP
JavaPanel
JavaPanelVP
JavaPopupMenu
JavaPopupMenuVP
JavaSplitPane
JavaSplitPaneVP
JavaSplitter
JavaSplitterVP
JavaTable
JavaTableVP
JavaTableHeader
JavaTableHeaderVP
JavaTree
JavaTreeVP
JavaWindow
JavaWindowVP
Kill
Label
LabelVP
LBound
LCase
Left
Len
Let
Like
Line Input
ListBox (Statement)
ListBox (User Action Command)
ListBoxVP
ListView
ListViewVP
Loc
Lock
Lof
Log
Lset
LTrim
MenuIDSelect
MenuSelect
Mid (Function)
Mid (Statement)
Minute
MkDir
ModuleVP
Month
MsgBox (Function)
MsgBox (Statement)
Name
New
'$NoCStrings
Nothing
Now
NPV
Null
Object Class
Oct
OKButton
On...GoTo
On Error
Open
Option Base
Option Compare
Option Explicit
OptionButton
OptionGroup
Pager
PagerVP
PasswordBox
Picture
PlayJrnl
Pmt
PopupMenuIDSelect
PopupMenuSelect
PPmt
Print
Private
ProgressBar
ProgressBarVP
PSCalendar
PSCalendarVP
PSGrid
PSGridHeader
PSGridHeaderVP
PSGridVP
PSMenu
PSMenuVP
PSNavigator
PSNavigatorVP
PSPanel
PSPanelVP
PSSpin
PSSpinVP
PSTree
PSTreeHeader
PSTreeHeaderVP
PSTreeVP
PushButton (Statement)
PushButton (User Action Command)
PushButtonVP
Put
PV
RadioButton
RadioButtonVP
Randomize
Rate
Rebar
RebarVP
ReDim
RegionVP
Rem
Reset
ResetTime
Resume
RichEdit
RichEditVP
Right
RmDir
Rnd
Rset
RTrim
ScrollBar
ScrollBarVP
Second
Seek (Function)
Seek (Statement)
Select Case
SendKeys
Set
SetAttr
SetField
SetProcID
SetThinkAvg
SetTime
Sgn
Shell
Sin
Space
Spc
SpinControl
SpinControlVP
SQAConsoleClear
SQAConsoleWrite
SQADatapoolClose
SQADatapoolFetch
SQADatapoolOpen
SQADatapoolRewind
SQADatapoolValue
SQAEnvCreateBaseline
SQAEnvCreateCurrent
SQAEnvCreateDelta
SQAFindObject
SQAGetCaptionTerminatorChar
SQAGetChildren
SQAGetDir
SQAGetLogDir
SQAGetOcrRegionRect
SQAGetOcrRegionText
SQAGetProperty
SQAGetPropertyArray
SQAGetPropertyArrayAsString
SQAGetPropertyArraySize
SQAGetPropertyAsString
SQAGetPropertyNames
SQAGetSystemLong
SQAInvokeMethod
SQALogMessage
SQAQueryKey
SQAResumeLogOutput
SQAScriptCmdFailure
SQASetAssignmentChar
SQASetCaptionTerminatorChar
SQASetDefaultBrowser
SQASetProperty
SQASetSeparatorChar
SQAShellExecute
SQASuspendLogOutput
SQASyncPointWait
SQAVpGetActualFileName
SQAVpGetBaselineFileName
SQAVpGetCurrentBaselineFileName
SQAVpLog
SQAWaitForObject
SQAWaitForPropertyValue
SQLClose
SQLError
SQLExecQuery
SQLGetSchema
SQLOpen
SQLRequest
SQLRetrieve
SQLRetrieveToFile
Sqr
StartApplication
StartAppUnderCoverage
StartAppUnderNone
StartAppUnderPnC
StartAppUnderPurify
StartAppUnderQuantify
StartBrowser
StartJavaApplication
StartSaveWindowPositions
StartTimer
Static
StaticComboBox
StatusBar
StatusBarVP
Stop
StopTimer
Str
StrComp
String
Sub...End Sub
SysMenuIDSelect
SysMenuSelect
Tab
TabControl
TabControlVP
Tan
Text
TextBox
Time (Function)
Time (Statement)
Timer
TimeSerial
TimeValue
Toolbar
ToolbarVP
Trackbar
TrackbarVP
TreeView
TreeViewVP
Trim
Type
Typeof
TypingDelays
UBound
UCase
Unlock
UserDefinedTC
Val
VarType
WebSiteVP
Weekday
While...Wend
Width
Window
WindowVP
With
Write
WriteTestCaseResult
Year
Appendixes
Appendix A SQABasic Syntax Summary
Arguments
Array Dimensions
Array Elements
Array Subscripts
Comments
Context Notation
Functions
Labels
Line Continuation Syntax
Line Numbers
Names
Parameters (parameters$) Argument
Recognition Method (recMethod$) Argument
Strings
Sub Procedures
Variables of User-Defined Type
Appendix B Trappable Error Codes
Appendix C Object Scripting Status Codes
Appendix D Derived Trigonometric Functions
Appendix E Mouse Actions
MouseClick Actions
MouseDrag Actions
Index