Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
100% found this document useful (2 votes)
481 views

ATEasy8ProgrammingLanguage PDF

Programming language

Uploaded by

nova debussy
Copyright
© Attribution Non-Commercial (BY-NC)
Available Formats
Download as PDF, TXT or read online on Scribd
100% found this document useful (2 votes)
481 views

ATEasy8ProgrammingLanguage PDF

Programming language

Uploaded by

nova debussy
Copyright
© Attribution Non-Commercial (BY-NC)
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 0

ATEasy Programming Language

Generated: May 20, 2010 (v8). Copyright 2010 Geotest - Marvin Test Systems Inc. All rights Reserved.



v
Table of Contents
1. Programming Language ______________________________________________________________________ 1
ATEasy - Programming Language Guide 1
Identifier Overview 1
Expressions, Operands and Operators 1
Operators and Rules of Precedence 2
Expression Rules of Precedence 4
Expressions Types 4
Expression promoting 5
See Also 5
2. Data Types __________________________________________________________________________________ 7
Basic Data Types 7
Variable Naming Conventions 8
Internal Data Type Naming Conventions 8
Type Modifier Data Type Naming Conventions 9
Object Naming Conventions 10
Numeric Data Types 11
DateTime Data Type 11
String Data Types 12
Bool Data Type 13
Variant Data Type 13
Procedure Data Type 15
Object Data Type 17
Any Data Type 17
3. User Defined Data Types _____________________________________________________________________ 19
Arrays 19
Arrays 19
Multiple Dimensions of Arrays 19
Strings as Arrays 20
Arrays and Variants 21
Assignment of Arrays 22
Arrays and Structs 23
Arrays as Procedure Arguments 25
Enum (Enumerated Values) 26
Structures (Struct) 27
TypeDef (Type Definitions) 28
4. Variables __________________________________________________________________________________ 29
About Variables 29
Overview of Variables 29
Variable Naming Conventions 29
Internal Data Type Naming Conventions 29
Type Modifier Data Type Naming Conventions 31
Variable Properties 31
Variables Scope 32
Lifetime 32
Accessing Variables and User-Defined Data Types by Name 33
Changing the Properties of Variables 33
Variables Search 33
ATEasy Programming Language
vi
5. Literals ____________________________________________________________________________________ 35
Integer Literals 35
Floating Point Literals 37
String Literals 38
Array and Struct Literals 39
Escape Sequences for String Literals 40
6. Data Conversion ____________________________________________________________________________ 43
Logical and Bitwise Data Conversions 43
Numeric Data Conversions 44
Character Data Conversion 46
Structs/Variants Data Conversion 46
Example 46
Comment 46
C/C++ and ATEasy Data Types 46
Visual Basic and ATEasy Data Types 48
7. Procedures ________________________________________________________________________________ 51
Procedures Overview 51
Procedure Parameters 51
Defining a Procedure Parameter 51
Array Parameters 52
Argument and Parameters Types 52
Declaring the Return Type 53
Returning Values in Procedure Code 53
Calling Procedures 54
How ATEasy Searches for Procedures 55
About Module Events 55
About DLLs 56
About I/O Tables 57
Classes, Properties, Methods, and Events 57
Classes 57
Properties 58
Methods 58
Events 58
8. COM Objects _______________________________________________________________________________ 59
Early Binding and Late Binding 59
Early Binding 59
Late Binding 59
Creating Objects 59
Creating Objects Using Late Binding 59
Creating an Object Using Early Binding 60
Getting Objects 60
Using Properties 61
Calling Methods 62
Deleting Objects 62
9. Scope _____________________________________________________________________________________ 63
Scope Operator and Scope Rules 63
Scope Rules 63
Scope Resolution Operator ('.') 63
Member Operator ('.') 64
Public Attribute 65
Public Members 65
Table Of Contents
vii
10. Statements _________________________________________________________________________________ 67
#ifdef Statement 67
Abort Statement 68
AddHandler Statement 68
Assignment Statement 72
Append Statement 74
Command Statement 75
Comment Statement 76
Continue Statement 77
Error Statement 78
Exit Statement 78
Exitloop Statement 79
ExitProgram Statement (ATEasy v5.0 ) 80
ExitTask Statement 80
ExitTest Statement 81
For Statement 81
Function Call Statement 82
Goto Statement 83
If Statement 84
Ignore Statement 86
Load Statement 86
Loop Statement 89
LoadLibrary Statement 90
Pause Statement 91
Print Statement 91
ReDim Statement 92
RemoveHandler Statement 93
Repeat Statement 94
Reset Statement 94
Retry Statement 95
Return Statement 96
Run Statement 97
Select Statement 98
Subroutine Call Statement 100
Task Statement 101
Test Statement 102
Trace Statement 103
Try Statement 105
Unload Statement 106
While Statement 107
UnloadLibrary Statement 108
11. Index ____________________________________________________________________________________ 109

1
Programming Language
ATEasy - Programming Language Guide
This guide describes the ATEasy programming language and includes information on the following topics:

Topic Description
Identifiers The rules for naming variables, objects, procedures, drivers, etc. and their scope.
Basic Data Types The internal data types, for example, Char, Bool, Long, Double, String, etc.
User Defined Data Types User-defined data types, for example, array, enum, struct, and typedef.
Variables The naming conventions, properties, and lifetimes of variables.
Literals The literal constant types.
Data Conversion The rules on how data is converted to different types, either automatically or by the
user.
Expressions Expressions, operands, operators, and rules of precedence.
Procedures The built-in function procedures of ATEasy.
COM Objects How COM objects are created and used, along with their properties and methods.
Scope How scope rules describe the order in which ATEasy searches for variables.
Statements The program elements that control how and in what order, data is manipulated.
Copyright 19912007 Geotest - Marvin Test Systems, Inc. All Rights Reserved.

Identifier Overview
An identifier uniquely distinguishes a variable, a procedure, a data type or any other ATEasy object. Identifiers are 1 to
256 characters in length. The general rule is that the first character must be alphabetic or an underscore, and the
remaining characters must all be alphabetic, numeric, or an underscore. The one exception is command names, where
the first character is allowed to be numeric.
ATEasy's comparison of identifiers is case-insensitive, that is, the upper-case alphabetic characters are considered to be
the same characters as their equivalent lower-case characters. For example, the characters, XYX, xyz, and XyZ are all
considered to be the same identifier.
Adopting a uniform approach to case is recommended. Also, all uses of the same identifier should use the same upper-
case or lower-case pattern and not rely on case-insensitivity.
See also
Identifier Naming Conventions
Expressions, Operands and Operators
A expression is a combination of keywords, operators, variables, and constants that yields a string, number, or object. An
expression can be used to perform a calculation, manipulate characters, or test data. Expressions are made up of
operators and operands. An operand is an entity on which an operator acts. Operands include constants, variables,
strings, function calls, subscript expressions, member-selection expressions, and complex expressions formed by
combining operands with operators or by enclosing operands in parentheses. Operators specify an evaluation to be
performed on one (unary) or two (binary) operands. There are three types of operators:
ATEasy Programming Language
2
A unary expression consists of either a unary operator followed by an operand as the
following syntax shows: operator operand. For Example, sizeof or typeof keywords
followed by an expression. The expression can be either the name of a variable or an
expression.
A binary expression consists of two operands and an operator in between as the
following syntax shows: operand1 operator operand2.
Operators and Rules of Precedence
Operators follow a strict precedence which defines the evaluation order of expressions containing these operators.
ATEasy operators are shown below in order of precedence from highest to lowest. Operators in the same level of
precedence are calculated from left to right.

Operator Name
Type,
Order of
Evaluation,
Level
Expressions Type Examples
( ) Expression,
Function
Binary, Left
to right, 1
(i+3)*2+abs(j)
. (dot) Member,
Scope
resolution
Binary, Left
to right, 1
Object, Struct, Module,
Library, Form
Program.Tests(i), System.m_iState,
btnOk.Caption, student.sName
[ ] Subscript Binary, Left
to right, 1
Array and Integer
inside the [ ]
aa[i, j], aa[i], sName[i]
& Address Of
Unary, N/A,
2
Unary, N/A, 10 dwDWord=&wWord
MemoryCopy(&aucBytes, &dw, 2, 2)
- Arithmetic
negation
Unary,
Right to
Left, 3
Numeric -23, -j
not Bitwise
complement
Unary,
Right to
Left, 3
Integer, Object, Bool,
Procedure

not bOk, not ob, not proc
descof Description
string
Unary,
Right to
Left, 3
Any expression descof proc_name, descof var_name
nameof Name string
Unary,
Right to
Left, 3
Any expression nameof var_name, nameof proc-name
sizeof Size in bytes
Unary,
Right to
Left, 3
Any expression sizeof aa[i], sizeof aa[i, j]
Programming Language
3
typeof Type string
Unary,
Right to
Left, 3
Any expression typeof i
^ Power
Binary,
Right to left,
4
Numeric i ^ 3, d ^ 3.4
* Multiplication
Binary, Left
to right, 5
Numeric i*j, i*2.25
/ Floating
point division
Binary, Left
to right, 5
Numeric d/3.14, d/2, i/3.4
div Integer
division
Binary, Left
to right, 5
Integer i div 3
mod Integer
remainder
Binary, Left
to right, 5
Integer i mod 3
+ Addition
Binary, Left
to right, 6
Numeric, String 3+4
- Subtraction Binary, Left
to right, 6
Numeric 3-j, d-4.45, v-5.04
shl Integer left
shift
Binary, Left
to right, 7
Integer i shl 4
shr Integer right
shift
Binary, Left
to right, 7
Integer j shr i
< Less than
Binary, Left
to right, 8
Numeric i<3, d<3.56, i<d, sName<"Ron"
> Greater than Binary, Left
to right, 8
Numeric j>d, sName>"Albert"
<= Less than or
equal to
Binary, Left
to right, 8
Numeric bsName<"Art", d<3.45
>= Greater than
or equal to
Binary, Left
to right, 8
Numeric sName>="Su"
= Equality Binary, Left
to right, 8
Numeric s="Yanor"
ATEasy Programming Language
4
<> Inequality
Binary, Left
to right, 8
Numeric j<>i, s<>"Neil"
and Bitwise AND Binary, Left
to right, 9
Integer i and 0b101
or Bitwise
inclusive OR
Binary, Left
to right, 9
Integer dwFlags or 0x20A
xor Bitwise
exclusive
OR
Binary, Left
to right, 9
Integer dwFlags or 1
new
(ATEasy
5.0)

Create new
COM or
.NET Object
Unary, Left
to right, 10
COM or .NET Class
Name
obEvt= new AEvent
dt=new MSCORLIB.DateTime(2005, 5, 5)
= Assignment
Binary, Left
to right, 11
Any expression i=j, sName="abc"

Expression Rules of Precedence
Expressions are calculated according to the following rules of precedence:
1. An operand between two operators of different precedence is bound to the operator with
higher precedence.
2. An operand between two equal operators is bound to the one on its left.
3. Expressions within parentheses are evaluated prior to being treated as a single operand.
Expressions Types
Expressions can be of the following types:

Type Description
bool-expr Any expression that evaluates to an boolean value of the Bool data type. Elements of an
boolean expression can include a function that returns a boolean value, a boolean literal, a
boolean constant(True or False), a boolean variable, a boolean Variant, or a function that
returns a boolean Variant. bool-expr are the result of any of the comparison operators (e.g.
'>=').
integer-expr Any expression that evaluates to an integer value of the following data types: Char, Byte,
WChar, Short, Word, Long, DWord, String element (Char or WChar). Elements of an integer
expression can include a function that returns an integer value, na integer literal, an integer
constant, an integer variable, an integer Variant, or a function that returns an integer Variant.
numeric-expr Any expression that evaluates to a floating point numeric value of the following data types:
Float, Double, Currency and DateTime. Elements of a numeric expression can include a
function that returns a numeric value, a numeric literal, a numeric constant, a numeric variable,
a numeric Variant, or a function that returns a numeric Variant.
string-expr Any expression that evaluates to a sequence of contiguous characters. Elements of a string
expression can include a function that returns a string, a string literal, a string constant, a string
variable, a string Variant, or a function that returns a string Variant.
Programming Language
5
procedure-expr Any expression that evaluates to an object. Elements of an object can include a function that
returns an object string, an object literal, an object constant (NoProcedure) or an object
variable.
object-expr
Any expression that evaluates to an object. Elements of an object can include a function that
returns an object string, an object literal, an object constant (Nothing), an object variable, an
object Variant, or a function that returns an object Variant.
Expression promoting
Boolean, integer and numeric expression are automatically prompted by the compiler when necessary. The following
rules may be use to determine when one expression type is promoted to another:
Operands that accept bool-expr also accept integer-expr.
Operands that accept numeric-expr also accept integer-expr and bool-expr.
Operands that accept integer-expr also accept bool-expr.
Operands that accept numeric-expr also accept integer-expr.
See Also
Data Types, Literals, Statements


7
Data Types
Basic Data Types
A data type defines the value(s) and the format that can be stored in a variable. The sizeof operator returns the size of a
data object in bytes. The table below shows the basic data types.


Type
Descriptio
n
Suffix

Size in
bytes
(sizeof
)
Value range Default
Value
Example
s
typeof
Char signed
integer
c 1 128 to 127 '\x000' 'a' or 12c "Char"
Byte unsigned
integer
uc 1 0 to 255 or 0xFF 0 10uc "Byte"
Short signed
integer
n 2 32,768 to 32,767 0 145n "Short"
Bool true or false 1 False (0) or True (<>0 or -1) False False "Bool"
Word unsigned
integer
w 2 0 to 65,535 or 0xFFFF 0 23w "Word"
WChar signed
integer
L 2 -32,768 to 32,767 0 'a'L "WChar"
Long signed
integer
l 4 2,147,483,648 to 2,147,483,647 0 123 or
123l
"Long"
DLong
(ATEasy
v5)
8 byte
signed
integer
ld
8 -9223372036854775808 to
9223372036854775807(0x7fffffffffffff
ff)
0 256ld "DLong"
DWord unsigned
integer
ul
4 0 to 4,294,967,295 0 123ul or
0xFA316
"DWord"
DDWord
(ATEasy
v5)
8 byte
unsigned
integer
uld 8 0 to
18446744073709551615(0xfffffffffffff
fff)
0 256uld "DDWord"
Float floating
point
f 4 3.4E +/- 38 (7 digits). Magnitude
range of +/- 1.2E -038.
0 3.56f or -
3.4E-38f
"Float"
Double floating
point
optiona
l letter
'd'
8 1.7E +/- 308 (15 digits). Magnitude
range of +/- 2.3E -308.
0 1.7E+308
or 3.56d
"Double"
Currency fixed point 8 See Currency "$0.00" See
Currency
"Currency"
DateTime floating
point
8 Jan 1, 100 to Dec 31, 9999 (date)
0:00:00 to 23:59:59 (time)
"12:00:00
AM"
See
DateTime
"DateTime
"
String NULL
terminated
ASCII
strings
The defined ASCII character set "" "Hello,
World."
"String"
BString fixed length
Unicode
L See
BString
The defined ASCII character set "" "Hello,
World."L
"BString"
ATEasy Programming Language
8
string
Variant See Variant v See
Variant
Varies by data type VarEmpty "Variant"
Procedur
e
Procedure 4
N/A
NoProcedur
e
GetName
Object Object 4
N/A
Nothing obChart
Any Pointer/Alia
s - See Any
See
Any
Varies by data type and data
element
Null "Any"
See Also
Data Types, User Defined Date Types, Variable Naming Conventions
Variable Naming Conventions
Internal Data Type Naming Conventions
ATEasy uses the recommended prefixes for naming internal (variables, user-defined) data types. Use the prefix naming
convention when you declare variables. Add the prefix before the data type.

Data Type
Recommended Prefix
Example
AColor clr clrRed
Afont font fontBold
AHandle h hDriverDMM
Any p pVar
APicture pic picButtonOff
APixel x, y, cx, cy xTopLeft
Bool
b
bOkay
BString
s or bs
sText
Byte
uc
ucDataByte
Char
c
cChar
Currency
cur
curTotalSales
DateTime
dtm
dtmStartDate
DDWord
ddw
ddwData
Data Types
9
DLong
dl
dlLongCount
Double
d
dMininum
DWord
dw
dwData
Enum type
enum
enumAAxisType
Enum member
axxx
aaxsTypeXAxis
Enum variable
en
enBorderStyle
Float
f
fButtonHeight
Long
l (letter "L")
lCount
Object
ob
obButtonOnOff
Procedure proc procCallBack
Short
n
nCount
String
s
sText
Structure
st
stData
Variant
v
vParam
Variant(Bool)
vb
vbOkay
Variant(BString)
vs
vsButtonName
Variant(integer number)
vi
viParam
WChar
wc
wcLast
Word
w
wIndex
Type Modifier Data Type Naming Conventions
The following table lists the Type Modifier data types and the recommended prefix to use when you declare a Type
Modifier as a variable. This data type is considered a Type Modifier because its basic data type is changed by adding a
Type Modifier prefix before the data type prefix.

Data Type: Type Modifier Recommended Prefix before
the Data Type Prefix
Example
Array a alMatrix
ATEasy Programming Language
10
Global (for public variables) g_ g_IStatus
Member (for private variables) m_ m_nHandle
Pointer or Var parameters p pbCancel

Object Naming Conventions
The following is a list of the ATEasy classes and controls, and their naming conventions used in this help system. For
more information, see classes or controls.

Class Class
Naming
Convention
Control Control Naming
Convention
AApp app AButton btn
AAxis axs AChart cht
AClipboard clipbrd ACheckBox chk
ACriticalSection crit AComboBox cb
ADriver drv ACommonDialog cdlg
AEvent event AGroupBox gb
AFont font AImage img
AForm frm AImageList imgl
AImageListImage imgli ALabel lbl
AMenu mnu AListBox lb
AMutex mutex ALog log
APicture pic APanel panel
APlot plt ARadioButton rad
AProgram prg AScrollBar sb
ASemaphore sem ASlider sld
AStatusBarPane sbrp AStatusBar sbr
ASystem sys ASwitch
sw
ATabPage tpg ATab tab
ATask task ATextBox
tb
ATest test ATimer tmr
AThumb tmb AToolBar tbr
AToolBarButton tbrb AVirtualKeyboard
vkb
Data Types
11
AUser user AAppFolder fld
AUsers users AAppShortcut shrtcut

Numeric Data Types
Numeric data types can be signed or unsigned numbers. They can be declared as arrays of up to sixteen dimensions,
with maximum sizes of 2 GB (2147483647 bytes, 32 bit). The default data for all numeric data types is zero (0). Numeric
data types include:
Signed Integers (Char, Short, Long, DLong, WChar)
Unsigned Integers (Byte, Word, DWord, DDWord)
Floating Point (Float, Double)
Currency
DateTime
Dlong and DDWord are 8 byte singed and unsigned integer types only available in ATEasy 5.0.
WChar stands for Wide Character and is a signed integer. WChar is based on the standard character set called Unicode
that can represent most characters in any language in the world, plus various symbols (for example, copyright, trademark,
etc.).
Floating Point numbers are based on the IEEE (Institute of Electrical and Electronics Engineers) format.
The Float type takes 4 bytes, including a sign bit, an 8-bit excess-127 binary exponent,
and a 23-bit mantissa (a number between 1.0 and 2.0), representing a range of 3.4E-38
to 3.4E+38 (either positive or negative). Float provides seven decimal-digits of accuracy.
The Double type takes 8 bytes, including a sign bit, an 11-bit excess-1023 exponent, and
a 52-bit mantissa (also a number between 1.0 and 2.0), representing a range of 1.7E-308
to 1.7E+308 (either positive or negative). Double provides 15 digits of accuracy.
Currency is an 8-byte (64-bit), two's complement integer, scaled by 10,000 to give a fixed-point number with 15 digits to
the left of the decimal point and 4 digits to the right. This represents a range of +/-922,337,203,685,477.5807. For
example, the value of $123.45 ("**") would be represented by the number 1,234,500 in a 64-bit number. Currency is
similar to the OLE standard currency data type. Currency values can be exchanged with Visual Basic programs.
The default value for Currency is "$0.00".

You can assign Currency to String and vice versa, for example:

curTotalSales="$112345.00"
str=curTotalSales.

DateTime Data Type
DateTime is a standard OLE data type. DateTime variables are stored as IEEE 64-bit, 8-byte floating-point numbers
(Double type) representing dates between January 1, 100 and December 31, 999 and times from 0:00:00 to 23:59:59.
DateTime variables display dates according to the short date format recognized by your computer and times displayed
according to the time format (either 12-hour or 24-hour) recognized by your computer.
When other numeric data types are converted to DateTime type, values to the left of the decimal point represent the date
information while values to the right of the decimal point (the fractional part) represent the time of day. Midnight is 0
(default value - "12:00:00 AM") and midday is 0.5 ("12:00:00 PM"). The value 2.0 represents January 1, 1900 and 3.0
represents January 2, 1900. Adding 1 to the value increases the date by one day.

Negative whole numbers represent dates before 30 December 1899.
ATEasy Programming Language
12
The following table includes more examples:

Numerics
Numbers
Date Time String Value
0 midnight "12:00:00 AM" (Default)
0.5 midday "12:00:00 PM"
2.0 January 1, 1900 "1/1/1900"
3.0 January 2, 1900 "1/2/1900"
2.5 12 o'clock noon on January 1, 1900 "1/1/1900 12:00:00 PM"
3.875 9:00 p.m. on January 2, 1900 "1/2/1900 9:00:00 PM"
DateTime is similar to the OLE standard date data type and its values can be exchanged with Visual Basic programs.
Any recognizable string date/time values can be assigned to its variables and its values can be set to a string; that is you
can assign DateTime to String and vice versa, for example:
dtCurDateTime="9/20/2007 2:28:00 PM"
str=dtCurDateTime.
The following examples shows how to calculate the time difference between two DateTime values:
! calculate time difference
dtm="12:00:01 AM" ! one second past after 0 value
dOneSec=dtm ! floating point value of one sec.
dtm1="9/30/2008 23:59"
dtm2="10/1/2008 00:01"
dDiff=(dtm2-dtm1)/dOneSec
if Round(dDiff)<>120 ! 120 sec.
TestStatus=FAIL
endif
See Also
Basic Data Types, Data Conversion, String Data Types, User Defined Data Types
String Data Types
The string data types include:
String (fixed size and variable size)
BString
The default for all string data types is an empty string ("").
Data Types
13
A String is a sequence of zero or more characters. All Strings have a length (number of characters used by the String)
and a size (number of characters used in memory). For example, a String could have a length of 32 characters out of its
100 character size in memory. The fixed size Strings have a fixed size in memory and the variable size Strings have
memory allocated as needed. The smallest unit of a String is a Char.
BString is a string of 16-bit characters (each a 2 byte WChar). BString is an OLE string that is also used as the only way
to send or receive data from COM objects outside of ATEasy. The data type holds Unicode characters. The header
(prefix) contains a character count, for example:

header Now is the time to do the work.
See Also
Basic Data Types, Data Conversion, Numeric, User Defined Date Types
Bool Data Type

Bool data type is used to store a boolean value of True or False.
The value is stored in a 2 byte signed integer (Short) that holds a value of True (-1) or False (0) with default value of
False.
Assigning an integer to a boolean will cause its value to be True if the integer is different than 0 and False 0 if it is 0.

See Also
Basic Data Types, Data Conversion, Numeric, Strings, User Defined Date Types


Variant Data Type
A Variant can serve as the universal data type. This means that you can store data of any type in a variable of type
Variant. A Variant is also a data item used to communicate with COM objects.
It contains an indicator of the type of data in addition to the actual data or a pointer to the data in the case of large data
items. The variant structure itself is 16 bytes. The following table shows the variant types (enumAVarType) that can be
created by ATEasy statements:

Name Value
ATEasy equivalent
vtEmpty
0
Un-initialized Variant variable
vtNull 1 SQL-style Null
vtI2 2
Short
vtI4 3
Long
ATEasy Programming Language
14
vtR4 4
Float
vtR8 5
Double
vtCy 6
Currency
vtDate 7
DateTime
vtBStr 8
BString
vtDispatch 9
Object
vtError 10 Error Code
vtBool 11
Bool
vtVariant 12 Variant
vtUnknown 13
Object of known type, for example, ACheckBox
vtDecimal 14
Decimal
vtUI1 17
Byte
vtI8 (ATEasy 5.0) 20 DLong
vtUI8 (ATEasy 5.0) 21 DDWord
If an ATEasy variable of a data type not listed above is assigned to a Variant variable, it is converted to the closest
matching type as shown in the following table:

Name
ATEasy data type to be converted
vtI2
Word, WChar
vtI4
DWord, Enum
vtBStr String
vtUI1
Char
If an ATEasy struct variable is assigned to a variant variable, the data bytes of the structure will be converted to a one-
dimensional array of bytes. ATEasy variables of type Procedure cannot be assigned to a variant -- the parser will flag this
as an error.
Data Types
15
If you assign one Variant to another, the resultant Variant will contain the value of the first Variant, but not the Variant
itself, for example,
vnA = nA ! nA is Short
vnB = vnA
Then vnB contains the value of nA, not the Variant vnA.
If you assign a String to a Variant, ATEasy will first convert the value of the String variable to a BString and then store
that value into the Variant.
If you assign an array to a Variant, ATEasy stores the entire array into the Variant, which can then be treated like an
array, with subscripting, etc.
The default value for a Variant is Empty.
Variants offer great flexibility, but at the expense of inefficiency, and can cause some problems when assigning
unexpected values.
You will get an error if you attempt to perform a mathematical operation or function on a Variant that does not contain a
number or something that can be interpreted as a number (for example, 2.4E13 is a valid number). When a Variant tries
to convert a non-numeric (such as a String containing a number) to a numeric value, it uses the Regional settings from the
Windows Control Panel to interpret the decimal separator, thousands separator, and currency symbol.
Using operators on Variants containing strings can lead to some problems. For instance, if two Variants (each containing
a numeric value) are separated by the "+" operator, a simple addition occurs. If the two Variants contained strings,
however, a concatenation would occur. But if one of them is a numeric and the other is a string, the Variant will try to
convert the string to an number and try to add them. If the conversion is unsuccessful, you will get a "Type mismatch"
error. If you wanted concatenation, you would need to first convert the numeric to a string.
Variants can be used as a way of handling a variety of data types. For instance, since all the elements in an array must
be of the same data type, you can set the data type of an array to Variant and then store objects alongside other data
types in that array.

See Also
Basic Data Types, Data Conversion, Numeric, Strings, User Defined Date Types
Procedure Data Type
A Procedure data type is a reference to a procedure.

The default is NoProcedure. For example, in the ATEasy Internal library, we have a String procedure called "Right(sStr,
lChars)", which returns the lChars leftmost characters of the string sStr. And we have another procedure named
"Left(sStr, lChars)" which returns the lChars rightmost characters of the string sStr. Now you create a variable "proc" with
data type of Procedure. Then you could assign "proc" to have different values in your code:
proc = Internal.Right ! Without the parentheses after the procedure
name
Print proc("ATEasy is Easy", 4) ! Result is "Easy"
proc = Internal.Left
Print proc("ATEasy is Easy", 6) ! Result is "ATEasy"
Note: Any form procedure or event must be called from that form or a form of the same type. If your program calls a
procedure by using a variable (of type Procedure, for example, the above "proc"), and the procedure it references is a
form procedure (either a procedure of the form or one of its events, or subcomponent procedures or events), then that call
must be from within the same form. ATEasy does not check the arguments of the Procedure variable (for example,
"proc") at design time. When you try to execute it at run time, ATEasy will check the arguments by looking for the
referenced form procedure within the scope of that form.
ATEasy Programming Language
16
Assigning Procedure to String and vice versa
You can assign a string to Procedure or set proc variable to a string containing a proc name. This makes convenient to
set a user defined procedure name at the run time. In the following example, GetOption() returns a string, proc name.
! retrieve detect procedure
procDetectUUT=GetOption(enOptionsDetectUUTProcedure)
if procDetectUUT=NoProcedure
return
endif

! the following sets other module's public proc:
proc="FaultAnalysis.ShowAnalyzeForm"
if proc
proc(aobProgram, GetCurrentForm().hWnd, IsModal())
endif
More examples that set string to a procedure and vice versa:
proc="DMM.SetFunction"
proc="SetFunction"
proc="RELAY.gxsw32.Gx6616Close"
proc=sModule+"."+"SetFunction"

sProc=Internal.Left
sProc=TestExec.cmdProgramExit
Checking Procedure Variable
Check if procedure variable is empty by comparing with NoProcedure or check the variable itself:
If proc=NoProcedure then return
If proc then proc()

Callback
A procedure variable or a procedure can be passed to DLL that later can call the ATEasy procedure from within the DLL:

User32.EnumWindows ( EnumWindowsCallbackFunction, 0x090A0B0C )
where EnumWindowsCallbackFunction is an ATEasy procedure. For further info, see DLL Example: Passing Callback
Procedure parameters by Value.

Storage
A Procedure data type variable is stored in a size of 4 bytes' memory.
Data Types
17
See Also
Basic Data Types, Data Conversion, Numeric, Strings, User Defined Date Types, AddHandler, RemoveHandler,
NoProcedure

Object Data Type
An Object variable can contain a COM object, stored in a 32-bit (4-byte) address and can have any valid object reference
assigned to it. The default value is Nothing.
Early binding versus late binding: A variable of type "Object" is called late bound. Since it can contain any COM
object, at run time ATEasy will have to perform validity checks to resolve the type, properties, methods, etc. If an Object
variable is "declared" with a specific class, then only objects of that class can be assigned to the variable. The parser can
verify if the attempted use is valid for that class, for example, the referenced member (property or method) exists. This is
called early binding.
As examples of early and late binding, say you declare a variable with a Name of "ob1" and use a Type of "Object". It will
be a late bound object variable. If you declare another variable with a Name of "ob2" and you enter a Type of "AMenu",
since AMenu is a known class object, it will be an early bound object variable.
Note: ATEasy provides a way at design time to tell if you have correctly typed in the name of a user-defined Type and/or
if the intended type has been defined. If in the Type field you enter a type in all one case (all lowercase or all uppercase,
for example, "amenu" or "AMENU") and press the Return key, ATEasy will attempt to find that type. If it finds it, it will
replace the type with the official name in mixed case, for example, "AMenu". If ATEasy does not find it, it will leave the
field as it was typed. This is a hint to you as a programmer that you have an undeclared type. You can still proceed to
write more code and worry about it later. But any time you parse that variable (for example, use any of the Run
commands, such as CheckIt!, DoIt!, etc.), ATEasy will generate an error message ("Unresolved type"). At that point, you
need to specify a known object type.
See Also
Using the Object Data Type, Basic Data Types, Data Conversion, Numeric, Strings, User Defined Date Types
Any Data Type
Any is a built-in basic type and it behaves like an alias to another ATEasy variable or data element (for example, in a
structure). That is, it holds not only 4 bytes of address of a symbol or an object, but also it keeps its data type (and more)
information. The following list describes the usage of type Any:
1. You can set the value of an Any variable by using anyX=&X, anyX will be the alias for X.
2. You can set the value of alias by using anyX=value. In this case X will have the value
(same as X=value) and anyX must have an alias before this statement is used.
3. Assigning Any variable anyX to another Any variable anyY will set anyX alias value to be
the value of the anyY alias.
4. You can compare two variables of type Any, which are alias to 'compatible' data type.
The aliased value will be compared.
5. Most operators (i.e. And, Or, +, etc) cannot be used with Any variables. You must assign
their alias value to other typed variable and then use the operators
6. You can have an array of Any type. Each array element can be set to set to be an alias
of a variable. For example: aAnyArray[2]=&adNum[4] will case the third element of the
aAnyArray to be an alias to the fifth element of adNum array.
7. You can use SizeOf and TypeOf operators to determine the alias size and type. If Any is
not assigned yet it's size will be 4 and type is Any and it value will be Null. For example
anyX=&dDouble, sizeof anyX will be 8 and type of anyX will be "Double".
8. You can get the true memory address of the Any alias by using &anyX. This can be used
for MemoryCopy (since it's source and target memory location are defined as DWord and
not as Any).
ATEasy Programming Language
18
9. You can check if an Any has an alias by checking anyX <> Null.
Initial Value
The only initial value which is allowed for an Any variable is Null. 0 and 0x0 are allowed as alternative ways of entering
the initial value, but the initial value is always displayed as Null.
Any parameter in DLL procedure
Any is used in DLL parameters so the user can pass different types of arguments.
During importing a DLL header file, C declaration VOID * will be converted to Var Any.
A Val Any parameter is used when the data value of the argument is to be passed to the DLL procedure. For an example
dll procedure "sprintf" expects data values of all different types. You can use for variable numbers of each sprintf item to
be of Val Any type. Please refer examples DLLs in "Language.prj" under ATEasy/Examples directory.
A Var Any parameter in a DLL procedure means that the address of the data value is to be passed to the ALL procedure.
When an argument is passed to Var Any it's memory address is pushed to the stack. For an example, DLL procedure
"sscanf" expects an address of (a variable number of) each item. In this case, you must declare as Var Any type. Please
refer example "DLLs" in "Language.prj" under ATEasy/Examples directory.
The following is an example of using the Any data type. Assume you have the following DLL procedure:
SendBinaryData (pData, lByteCount): Void
pData Var Any
lByteCount Val Long
If this DLL procedure is called as follows, the procedure will "send" the 8 bytes of the Double variable dValue:
SendBinaryData (dValue, sizeof dValue)
and the following call will "send" the 24 bytes contained in the 2 by 3 array of Float, afArray:
SendBinaryData (afArray, sizeof afArray)

The following examples illustrate Any variables usage :
any1=&a3i ! a3i is an array of Long of size 3
any2=&a3i[0] ! now any2 is pointing to the address of the first
element
Suppose ai is an array of at least its size 3. The following assignments are all legal:
any1=ai
any2=7
but the following assignments are illegal (run-time errors):
any1=7 ! 7 is not array
any2=ai ! ai should be a long value
because the right hand sides' data types are not compatible with the left hand sides.
See Also
Basic Data Types, Data Conversion, Numeric, Strings, User Defined Date Types

19
User Defined Data Types
Arrays
Arrays
An array is a collection of data values of the same type. The number of values in the array is called the dimension. The
individual values are referred to by using the name of the array following by an integer expression enclosed in square
brackets. This integer value is called a subscript and runs from zero to one less than the dimension.
For example, if ad is an array of three doubles, ad[0] refers to the first value, ad[1] to the second, and ad[2] to the third or
last value. The following code sample calculates the average value of an array of 20 voltage readings:
adVolts: Double[20]
dAverage: Double
dSum: Double
n: Short
dSum = 0
for n=0 to 19
dSum=dSum+adVolts[n]
next
dAverage=dSum/20
If the subscript value is less than zero or greater or equal to the dimension of the array, then an error occurs. For constant
literal subscripts this is checked when the code is parsed. For all other cases the check is made at run time.
Maximum Size of an Array
The size of the array is limited to 32 bit which is 2 GB (2147483647 bytes). Make sure you have enough memory before
you define a very large array. Otherwise your computer will run out of memory and will slow down or even crash. Couple
of MB would be no problem. The maximum dim size of an array is 16.
See Also
Arrays and Structs, Arrays and Variants, Arrays as Procedure Arguments, Assignment of Arrays, Multiple Dimensions of
Arrays, Strings as Arrays, User Defined Data Types
Multiple Dimensions of Arrays
ATEasy allows multi-dimensional arrays. A two dimensional array is an array of arrays, a three dimensional array is an
array of arrays of arrays, etc. The individual values are referred to by the array name followed by a series of integer
expressions, separated by commas, and enclosed in square brackets. For example, af[i, j,k] refers to one value in a 3-
dimensional array of floats.
Array Slices
The values are stored is row-major order, that is, the right-most subscript varies most rapidly. Thus, if an is a 3 by 2 array
of shorts, then the individual values are stored in the order an[0,0], an[0,1], an[1,0], an[1,1] , an[2,0], an[2,1]. This storage
layout facilitates the extraction of sub-arrays, or slices, from a multi-dimensional array. A sub-array or slice can be referred
to by using fewer subscripts than the array has dimensions.
ATEasy Programming Language
20
The right-most subscript can be omitted to refer to a 1-dimensional slice, the right-most two subscripts can be omitted to
refer to a two dimensional slice, etc. Thus, if ad is a 3 by 4 by 5 array of doubles, it can be thought of as an array of 3
elements, each of which is an array of 4 elements, each of which is an array of 5 doubles. The first double value is
ad[0,0,0] and the last is ad[2,3,4]. The first 1-dimensional slice is ad[0,0] and the last is ad[2,3]. The first 2-dimensional
slice is ad[0] and the last is ad[2]. A reference to ad without a subscript is a reference to the whole array.
If a is a two dimensional array, then a[i,j] and a[i][j] both refer to the same element. However the first form is far more
efficient as the run time uses the subscripts to calculate the linear offset of the desired element in the list of values. The
second form creates a temporary array variable consisting of the i'th slice of the array and then subscripts that temporary
array to get the j'th element.
Calculating array dimension size
Array dimension can be calculated dynamically using the sizeof operator as the following example demonstrates:
The following code sample assumes that 25 samples have been made of the voltages on 7 different pins and calculates
the average voltage for each pin. The first subscript of the 2-dimensional array adPinReadings is the pin number and the
second subscript is the sample number. The 7 slices of the 2-dimensional adPinReadings array are passed to the function
DblAverage to calculate the average of the 25 readings for each pin.
adPinReadings: Double[7,25]
adPinAverages: Double[7]
i: Long
iCount: Long

iCount=sizeof(adPinReadings) div sizeof(adPinReadings[0]) ! 7
for i=0 to iCount-1
adPinAverages[n] = DblAverage(adPinReadings[n], 25)
next
See Also
Arrays (Definition), Arrays as Procedure Arguments, Arrays of Variants, Assignment of Arrays, Strings as Arrays
Strings as Arrays
String and BString values can be treated as 1-dimensional arrays of Chars and WChars respectively. For example, if s is
an String variable which has the value "ABC", then s[0] is the character 'A', s[1] is the character 'B', and s[2] is the
character 'C'. It is an error if the subscript value is less than zero or is greater or equal to the current length of the string.
Multi-dimensional String and BString arrays can be subscripted down to the character level by adding one more subscript
(the character index) to a reference which subscripts the array down to the individual string level. For example, if abs is a
4 by 5 array of BStrings, and abs[2,1] is "abcdef"L, then abs[2,1,4] is the WChar value 'e'L.
See Also
Arrays (Definition), Arrays and Structs, Arrays as Procedure Arguments, Arrays of Variants, Assignment of Arrays,
Multiple Dimensions of Arrays
User Defined Data Types
21
Arrays and Variants
Arrays of Variants
An array of variants can be used to collect data items of different types as each variant can contain any of the standard
kinds of variant data, including an ATEasy array. If av is an array of 5 variants, then av[0] could contain the string "XYZ",
av[1] could contain the short integer 12345, av[2] could contain the double 3.14159, av[3] could contain a reference to an
ACheckBox control, and av[4] could contain a 10 by 20 array of floats.
Variants Containing Arrays
An ATEasy array with any number of dimensions can be assigned to a variable or array element of type Variant. Since
the parser cannot know what is contained in a Variant value, it allows any Variant value to be subscripted with any
number of subscripts. When the reference to the presumed array element is evaluated at run time, it is verified that the
Variant contains an array, that the number of subscripts is less than or equal to the number of dimensions in the contained
array, and that the value of each subscript is within the proper range. A run time error occurs if any of these conditions is
violated.
The ATEasy code which accesses the elements of an ATEasy array which has been stored in a Variant needs to know
how many dimensions there are, the size of each dimension, and the type of the array elements. There are three routines
in the Internal library which can be used to determine the needed information :
VarDim(vr) returns the number of dimensions (0 if the variant does not contain an array)
VarDimSize(vr,lDim) returns the size of the requested dimension. lDim is 0 for the first, 1
for the second, etc.
VarType(vr) returns the type of the value contained in the Variant. For arrays, the type of
the array elements is returned. The return value is one of the values of the enumerated
type enumAVarType.
In the most cases the code storing the ATEasy array into the Variant will be in close agreement with the code which
processes the Variant and the above routines would be used to verify that no mistake was made in creating the Variant.
Row-major Versus Column-major Order
Visual Basic and ActiveX controls assume that arrays are stored in column-major order, that is, the first subscript varies
most rapidly. When an ATEasy array is assigned to a Variant or vice versa, the element order is rearranged from row-
major order to column-major order, and vice versa. This means that if an ATEasy array is assigned to a Variant and
passed to a method of an ActiveX control written in Visual Basic, a subscripted reference to any array element in the
Visual Basic code refers to the very same element value as an ATEasy subscripted reference to the original data with the
exact same list of subscripts. For example, if anPoints is a 10 by 2 array of shorts representing 10 X-Y screen positions,
both the ATEasy code and the Visual Basic code refer to the Y coordinate of the 5th point as anPoints[4,1].
Effect of Subscripting in Arrays of Variants Which Themselves Contain Arrays
If an ATEasy array of Variants is subscripted using more subscripts than the number of dimensions of the Variant array, it
is presumed that the referenced Variant element contains an array and that the extra subscripts are to be used to index
into that array. If a n-dimensional array of Variants is assumed to contain a m-dimensional array in each Variant, the effect
of subscripting the Variant array with differing numbers of subscripts is given below:

Subscripts Description
1 to n-1 subscripts A slice of the Variant array
n subscripts A Variant (which contains a m-dimensional array)
n+1 to n+m-1 subscripts A slice of the array contained in the referenced Variant element
n+m subscripts A basic element of the array contained in the referenced Variant element
See Also
Arrays (Definition), Arrays and Structs, Arrays as Procedure Arguments, Assignment of Arrays, Multiple Dimensions of
Arrays, Strings as Arrays
ATEasy Programming Language
22
Assignment of Arrays
Assigning an ATEasy array to another ATEasy array
In order to assign one ATEasy array or array slice to another ATEasy array or array slice, both arrays must have the
same number of dimensions and all dimensions but the first must have the same size. If the array on the left side of the
assignment is smaller, the array elements are assigned until the left-side array is full. If the array on the right side of the
assignment is smaller, the array elements are assigned until all the elements of the right-side array have been assigned.
The remaining elements of the left-side array are left unchanged.
In addition the data type of the right-side array must be assignment compatible with the data type of the left-side array,
that is, it must be legal to assign a value with the right-side data type to a variable with the left-side data type. When one
array is assigned to another, the effect and validity checking is precisely the same as for a series of nested loops which
copy the elements one-by-one in row-major order, that is, with the right-most subscript varying most rapidly. For example,
if ad1 and ad2 are both 3 by 7 arrays of Doubles, then the assignment statement
ad1 = ad2
has precisely the same effect as the following loops.
for n1=0 to 2
for n2=0 to 6
ad1[n1,n2] = ad2[n1,n2]
next
next
The following declarations and assignment statements illustrate valid and invalid assignment statements:
ad23V01: Double[2,3]
ad23V02: Double[2,3]
ad43V03: Double[4,3]
ad24V04: Double[2,4]
ac23V05: Char[2,3]
as23V06: String[2,3]
ad3V07: Double[3]
ad23V01 = ad23V02 ! OK - everything agrees
ad23V02 = ad43V03 ! OK - only first 6 Doubles (first 2 rows) will be
copied
ad43V03 = ad23V01 ! OK - only first 6 Doubles (first 2 rows) of
ad43V03 will be set
ad23V01 = ad24V04 ! BAD - size of 2nd dimension differs
ad23V01 = ac23V05 ! OK - A Char value can be assigned to a Double
as23V06 = ad23V02 ! BAD - A Double value cannot be assigned to a
String
ad3V07 = ad23V01[1] ! OK - assign second row of ad23V01 to ad3V07
User Defined Data Types
23
ad23V02[0] = ad3V07 ! OK - set first row of ad23V02 to values in
ad3V07
Assigning an ATEasy array to a Variant
Visual Basic and ActiveX controls assume that arrays are stored in column-major order, that is, the first subscript varies
most rapidly. When an ATEasy array is assigned to a Variant or vice versa, the element order is rearranged from row-
major order to column-major order, and vice versa. This means that if an ATEasy array is assigned to a Variant and
passed to a method of an ActiveX control written in Visual Basic, a subscripted reference to any array element in the
Visual Basic code refers to the very same element value as an ATEasy subscripted reference to the original data with the
exact same list of subscripts. For example, if anPoints is a 10 by 2 array of shorts representing 10 X-Y screen positions,
both the ATEasy code and the Visual Basic code refer to the Y coordinate of the 5th point as anPoints[4,1].
Assigning a Variant to an ATEasy array
The elements from the Variant array are taken in column-major order and stored into the ATEasy array in Row-Major
order until either array is exhausted.
If same number of dimensions and all but the first dimension have the same size, the "meaning" of the array is preserved
as explained above, for "Assigning an ATEasy array to a Variant". If not, then as much data as possible is copied is
copied in the same linear order of elements. If this is a problem, use VarGetDimCount and VarGetDimSize to verify that
the array in the Variant is compatible with the ATEasy array.
See Also
Arrays (Definition), Arrays and Structs, Arrays as Procedure Arguments, Arrays of Variants, Multiple Dimensions of
Arrays, Strings as Arrays
Arrays and Structs
Arrays contain elements and structs contain fields. The elements of an array can be a struct type and a struct can contain
one or more fields which are arrays. Therefore, it is possible to have an Array1 of type Struct1, which in turn has as a
field, Array2.
Array of a Struct
As an example of an array of a struct, say you define a struct named Student, containing two fields, Name and Id:
Struct: Student
Name: String
Id: Long
Then you can define std as struct Student:
std: Student
One record might be:
std={"John",1}
An array of that struct might be:
astd: Student[2]
astd={ {"John",1},{"Mary",2} }
Array of Struct of an Array
A Struct can also contain a field which is itself an array. Using the previous example, let's expand the original struct
Student by making Name into an array of two strings:
aName: Name[2]
ATEasy Programming Language
24
where aName(1) is the first name and aName(2) is the last name. Now:
Struct: Student
aName: String
Id: Long
Then you can define std as struct Student:
std: Student
One record might be:
std={{"John","Smith"},1}
An array of that struct might be:
astd: Student[2]
astd={ { {"John","Smith"}, 1 } , { {"Mary","Jones"}, 2 } }
Since arrays are zero-based, the last name of the first student in this example would be:
astd[0].aName[1]
Struct of as Struct
The fields of a struct can also have a struct type as a field. In the following example, the struct Class contains another
struct Person:
Struct: Person
aName: String
Id: Long
Struct: Class
CourseName: String
Department: String
CourseNum: Short
Instructor: Person
nStudents: Short
aStudent: Person[40]
We define a history class:
clsHistory: Class
The name of the last student in the history class would be:
clsHistory.aStudent[clsHistory.nStudents-1].aName
See Also
Assignment of Arrays, Strings as Arrays, Struct, Assigning Structs to Structs or to Variants
User Defined Data Types
25
Arrays as Procedure Arguments
Arrays may be passed as arguments to procedures by Val (by value) or by Var (by reference).
Val Parameters
The array argument passed to an array Val parameter must have the same number of dimensions and the data-type of
the argument must be assignment-compatible with the data-type of the Val parameter. The size of each dimension of the
Val parameter is set to match the array argument passed. After this, the array argument is assigned to the array Val
parameter (for more details, see Array Assignment). The array Val parameter is a local variable of the called procedure
and changes to the array Val parameter during the execution of the procedure have no effect on the array argument which
was passed.
Var Parameters
The array argument passed to an array Var parameter must have the same number of dimensions and the data-type of
the argument must be the same as the data-type of the Var parameter, since the Var parameter is only a temporary alias
to the actual array argument passed. Any assignment to the array Var parameter or one of its elements is really an
assignment to the corresponding part of the passed array argument. The size of each dimension of the Var parameter is
set to match the array argument passed.
Determining the Size of Each Dimension of an Array Parameter
The sizeof operator can be used to determine the size of each dimension of the array parameter for the current call. The
procedure may require the size of one or more of the dimensions to have a certain size because of the way the procedure
is coded and/or the task is supposed to perform. For example, an array Val parameter may be used to transform 3-D data
points from one coordinate system to another, in which case the array must be 3 by 3. Alternatively, the procedure may be
written to accept any size for the dimensions of the passed argument, but needs to know the upper limit to be used in the
loops which process the individual elements of the array. An example of this would be a procedure which accepts an M by
N array representing N samples on each of M pins and which calculates the average reading for each pin.
The total number of elements in an array is the sizeof the array divided by the sizeof the data-type of the array. For
multiple dimensional arrays, the number of elements in a slice of the array parameter can be calculated and divided into
the total number of elements to get the number of slices in the array. For example, if parameter ad is a one-dimensional
array of Doubles, the number of elements in the passed argument array is:
Sizeof ad div sizeof Double
and if parameter an is a two-dimensional array of Shorts, the number of elements in a row is:
Sizeof an[0] div sizeof Short
and the number of rows is the total number of elements divided by the number in each row.
Although the sizeof is a prefix operator, the operand can be enclosed in parentheses to make it look like a function call.
Also using the real divide operator / instead of the integer divide operator div will still calculate the correct answer, but at
the cost of converting the sizes to Float before the division and convert the result back to an integer afterward. Thus the
first example above would work correctly if rewritten as:
Sizeof(ad) / sizeof(Double)
The following example shows a procedure with a Val parameter which is a two-dimensional array of Doubles. This M by N
array of Doubles is interpreted as N voltage samples on each of M pins and the average voltage for each pin is printed to
the log.
Procedure ListPinVoltage( adSamples): Void
------------------------------------------
adSamples: Val Double[ , , ]
dSum: Double
nElements: Short
ATEasy Programming Language
26
nPin: Short
nPinCount: Short
nSample: Short
nSamplesPerPin: Short
{
nElements = sizeof adSamples DIV sizeof Double
nSamplesPerPin = sizeof adSamples[0] DIV sizeof Double
nPinCount = nElements DIV nSamplesPerPin
FOR nPin = 0 TO nPinCount-1 DO
dSum = 0.0
FOR nSample = 0 TO nSamplesPerPin -1 DO
dSum = dSum + adSamples[nPin, nSample]
NEXT
PRINT "Pin # "; nPin; " voltage "; dSum/nSamplesPerPin
NEXT
}
See Also
Arrays (Definition), Arrays and Structs, Arrays of Variants, Assignment of Arrays, Multiple Dimensions of Arrays, Strings
as Arrays
Enum (Enumerated Values)
An Enum is an enumerated value, that is, a data type which allows you to assign values to names. An Enum data type is
always a "Long Constant". For example, you can create an enumerated data type named "enumMy", with three constants
(Value1, Value2, and Value3):
Types
===========
enumMy: Enum
{
Value1: Long Const = 1
Value2: Long Const = 22
Value3: Long Const = 36
}
User Defined Data Types
27
In programming code, you can use the "Value2" as a constant, limited by the rules for scope for that variable. If you have
two variables of the same name within the range of scope, for example, two enum constants called "Value2", ATEasy will
use the first one it finds. If there is a possibility of duplicate constants, you can use the enumerated type name (or library
name, if you wish to refer to a constant in the internal library) as a qualifier, for example,
LX = enumMy.Value2 ! LX is Long
See Also
Arrays, Struct, TypeDef
Structures (Struct)
A Structure is a data type that contains one or more fields. These fields can be of different data types themselves. In
ATEasy, you first create a Type of data type "Struct". Once it is declared, you can use it in code. For instance, you
declare a Type as "Struct" with the name "programmer", and then define two fields in that Structure (one field named
"FirstName" as String and the other field named "Age" as Short).
Types
===========
programmer: Struct
{
sFirstName: String
nAge: Short
}
Once a structure is defined, you can declare a variable of that structure, such as "programmerNew", where "programmer"
is the prefix and "New" is the main part of the variable name:
programmerNew: programmer
In procedure code, you can assign values to the structure's components:
programmerNew.sFirstName="George"
programmerNew.nAge=45
A Structure can contain fields of any type, including an array or another Structure.
Struct of as Struct
The fields of a struct can also have a struct type as a field. In the following example, the struct Class contains another
struct Person:
Struct: Person
aName: String
Id: Long
Struct: Class
CourseName: String
Department: String
ATEasy Programming Language
28
CourseNum: Short
Instructor: Person
nStudents: Short
aStudent: Person[40]
We define a history class:
clsHistory: Class
The name of the last student in the history class would be:
clsHistory.aStudent[clsHistory.nStudents-1].aName
See Also
Arrays, Enum, TypeDef
TypeDef (Type Definitions)
A Typedef declaration allows you to make a synonym or "alias" for another type. Typedef declarations do not introduce
new types, but introduce new names for existing types.
To create a new TypeDef, start with adding a new Type. Its default Type is Struct. Change its name to the desired "alias",
for example, "SecurityCode". On its property page, select the desired Type, for example, Long. On the list of Types, you
will now see SecurityCode as a Type of data type Long.
Types
===============
SecurityCode: Long
You can now declare a new variable of data type "SecurityCode" and it will have the same data type of Long. For
example, you can declare "TempSecCode" to be of type "SecurityCode":
TempSecCode: SecurityCode
In a similar manner, you can create a new Type named "Logical" to be of Type Bool. "Logical" is a TypeDef (alias) for
Bool. New variables can be created of Type Logical, example, "PowerOn".
Such TypeDefs can be used to assign variables of one Type and change their Type later very easily, by reassigning the
name to have a different data type. As long as your code does not object to the change in data types, it should function.
Note: Some data conversion rules may cause problems with some data type changes. As a precaution against loops of
one Type being made a TypeDef for another, which is a TypeDef for the first Type, ATEasy has a built in limit of 25 levels
of aliases
See Also
Arrays, Enum, Struct

29
Variables
About Variables
This chapter describes how to use variables and contains the following topics:

Topic Description
Overview of Variables Overall summary of variables.
Variable Naming
Conventions
Describes the recommended prefixes to use for naming internal data types and Type
Modifier data types.
Variable Properties Describes properties for variables.
Variables Search Describes how ATEasy searches for variables.
Overview of Variables
A variable is a named, temporary location in the computer's memory where data is stored. A variable must have a data
type, such as long, float, char, word, short, string, or variant. The data type signifies:
Size of the data stored in the variable.
Interpretation of the data stored in the variable.
Type of operation performed on the data in the variable.
You can create and use variables in the Program, System, and Driver modules, and within a Procedure or Event or a
Form.
By default, variables are non-public or local. Non-public or local means that a variable defined in one module is not visible
from another module. Hiding variables from another module is generally a good programming practice because code from
one module is not able to change the variable values defined in another module.
A variable can be used in several ways when you are writing code. Variables can be used in:
An assignment statement where you assign a value to a variable and change its value.
For example: nStatus=3
where the value 3 is assigned to the variable nStatus.
An expression where a variable value is used to calculate another value.
For example: '3*lValue+5'
As a parameter to a procedure or a function.
For example: 'tan(dValue)'
where the function tan calculates the parameter dValue.

Variable Naming Conventions
Internal Data Type Naming Conventions
ATEasy uses the recommended prefixes for naming internal (variables, user-defined) data types. Use the prefix naming
convention when you declare variables. Add the prefix before the data type.

ATEasy Programming Language
30
Data Type
Recommended Prefix
Example
AColor clr clrRed
Afont font fontBold
AHandle h hDriverDMM
Any p pVar
APicture pic picButtonOff
APixel x, y, cx, cy xTopLeft
Bool
b
bOkay
BString
s or bs
sText
Byte
uc
ucDataByte
Char
c
cChar
Currency
cur
curTotalSales
DateTime
dtm
dtmStartDate
DDWord
ddw
ddwData
DLong
dl
dlLongCount
Double
d
dMininum
DWord
dw
dwData
Enum type
enum
enumAAxisType
Enum member
axxx
aaxsTypeXAxis
Enum variable
en
enBorderStyle
Float
f
fButtonHeight
Long
l (letter "L")
lCount
Object
ob
obButtonOnOff
Procedure proc procCallBack
Variables
31
Short
n
nCount
String
s
sText
Structure
st
stData
Variant
v
vParam
Variant(Bool)
vb
vbOkay
Variant(BString)
vs
vsButtonName
Variant(integer number)
vi
viParam
WChar
wc
wcLast
Word
w
wIndex
Type Modifier Data Type Naming Conventions
The following table lists the Type Modifier data types and the recommended prefix to use when you declare a Type
Modifier as a variable. This data type is considered a Type Modifier because its basic data type is changed by adding a
Type Modifier prefix before the data type prefix.

Data Type: Type Modifier Recommended Prefix before
the Data Type Prefix
Example
Array a alMatrix
Global (for public variables) g_ g_IStatus
Member (for private variables) m_ m_nHandle
Pointer or Var parameters p pbCancel

Variable Properties
Variables have many characteristics that are important to understand when building ATEasy applications. This section
defines the characteristics (properties) of ATEasy variables and user-defined data types.
To display the properties of the nCounter variable, you can either double-click on the icon to the left of the nCounter
variable; or you can select (highlight) nCounter and then select Properties from the View menu or click on the Properties
tool from the standard toolbar.
The following figure shows an example of the Variable Properties window. The programmable properties of a variable
include name, type, dimension (Dim), dimension size (Dim Size), description (Desc), and Public (not shown, hidden
behind the Type list).
ATEasy Programming Language
32

The following table describes the General properties on the Variable Properties window. For a description of the
properties on the Value page, see Variable Properties (Value Page).

Property Description
Name See Variable Naming Conventions for additional information on naming variables or user-
defined data types.
Type Use the drop-down selector to display the list of data types or type the data type name.
Browse Browse for any previously defined data type. Data types defined in other modules must be
public to be visible.
Dim Specify the dimensional size. Zero = not dimensioned, one = one dimensional, two = two
dimensional, etc., up through 16 dimensions.
Dim Size Specify the size of each dimension. When Dim is zero, Dim size cannot be accessed.
Description Your description of the variable or user-defined data type.
Public See Variable Scope further in this section
Variables Scope
Scope can be thought of as visibility (which module can see a variable). The scope of a variable is limited to the module in
which it is declared unless you take a specific action to declare the variable as global (public). Declaring a variable as
local or public is done from the property window.
Lifetime
Lifetime can be thought of as duration. The period of time a variable exists defines its lifetime. A variable's lifetime varies
depending on the module it belongs to.

Module/Submodule Lifetime
Program As long as the program is active (running). When multiple programs exist within a project,
only one program can be active at any one time.
System & Driver As long as the application is running.
Form As long as the form is displayed.
Variables
33
Accessing Variables and User-Defined Data Types by Name
Variables and user-defined data types may be accessed (from ATEasy modules) by name. It is possible to have multiple
variables with the same name, for example, driver1 and driver2 could both have a variable named Time_samples. To
ensure you access the correct variable, use a dot notation (that is, driver1.Time_samples or driver2.Time_samples).
Changing the Properties of Variables
Our next step would be to change the properties of our three variables. We will start with nCounter as its properties are
already displayed. Most properties of nCounter are already defined. Let us add "Loop Counter" as the description (Desc)
and continue with afNumbers (do so by clicking once on afNumbers in the Variables View).
The prefix of afNumbers is "af" with "a" representing an array and "f" representing a Float variable. Select Float from the
Type selection list and change the Dim to 1. Dim Size now displays [1]. Change the size to 11 by typing over the "1" and
then add "List of Numbers" in the Description field.
Our last step would be to select fAverage (by clicking on it once) and then changing the Type to Float and adding
"Average of n Numbers" to the description field.
For information on how to create and use variables, see About Variables.

Variables Search
When a variable name is used in code, ATEasy will search for the variable to locate where it is defined. Since variables in
different modules (or even in different submodules of the same module) can have the same name, ATEasy must decide
which one is being referred to in the current code statement. ATEasy follows a specific search sequence and the first
variable that ATEasy finds with the given name will be used.
To bypass the way ATEasy searches for a variable, you can also use the Scope Resolution Operator to specify where the
variable is defined (for example, ModuleName.VariableName, such as 'Driver1.nCount'). For more information, see Scope
Resolution Operator.
ATEasy statements are made up of a series of tokens. A token can be a keyword (for example, 'while'), an operator (for
example, '+'), a literal (for example, number or a quoted string), or a variable name, and more. Depending on the
statement used, ATEasy determines the possible token type and searches for it.
How ATEasy searches for a variable is important because variables defined in a Program, System or Driver module, or
within a Procedure/Event or a Form can have the same name.
In general ATEasy will first search for a variable in the current module, the module where the variable is used, in the
following order:
If the variable is used in a Procedure or Event, ATEasy looks in the Procedure or Event
variables or parameters.
If the variable is used in a Control Event, ATEasy searches in the Control properties.
If the variable is used in a Form Procedure or Event, ATEasy searches in the Form
variables and then in Form properties.
ATEasy then looks in the module variables and module COM libraries variables.
If the variable is not found, ATEasy will then search for public variables that are visible in other modules as follows:
If the current module is a Program module, ATEasy searches in the System module and
then in the System Drivers (starting from the last driver to the first).
If the current module is a System module, ATEasy searches in the System Drivers
(starting from the last driver to the first).
If the current module is a Driver module, ATEasy searches in the System Drivers
(starting from the last driver to the first).


35
Literals
Integer Literals
Integer literals are constant data elements that have no fractional parts or exponents. They always begin with a numeral
(0-9). You can specify integer constants in decimal, octal, hexadecimal, or binary form. You can specify signed or
unsigned types and long or short types. If there is no specified suffix, the default type is Long.
ATEasy has the following integer literals:

Type Description Recommended
prefix for
variables
Suffix Size in
bytes
(sizeof)
Value range Examples
Char signed
integer
c 1 128 to 127 'x'
Byte unsigned
integer
uc uc 1 0 to 255 10uc
Short signed
integer
n n 2 32,768 to 32,767 145n
Word unsigned
integer
w w 2 0 to 65,535 23w
WChar signed
integer
wc L 2 -32,768 to 32,767 'a'L
Long signed
integer
l (letter 'L") l 4 2,147,483,648 to
2,147,483,647
123, 123l
(suffix of
lower case
letter 'L')
DLong 8 byte signed
integer
ld ld 8 -9223372036854775808 to
9223372036854775807
256ld
DWord unsigned
integer
dw ul 4 0 to 4,294,967,295 123ul or
0xFA316
DDWord 8 byte
unsigned
integer
ddw uld 8 0 to
18446744073709551615
256uld
Syntax
literal [optional suffix]
The syntax has the following parts:

Name Type Description
literal literal constant A decimal, hexadecimal, binary, or
char constant.
suffix suffix A character string specifying the type
of literal constant. See table above.
Where
literal can be one of the following:
ATEasy Programming Language
36

Name Components Description
decimal-constant The digits 0-9: 0 1 2 3 4 5 6
7 8 9
The first digit may be zero.
hexadecimal-constant 0x plus one or more
hexadecimal digits.
The hexadecimal digit may be one of
the following:
0 1 2 3 4 5 6 7 8 9
a b c d e f
A B C D E F
binary-constant 0b plus one or more binary
digits.
The binary digit may be one of the
following:
0 1
char-constant For ASCII constants, the
alphabetic characters A
through Z (either upper or
lower case). For escape
sequences, any alphabetic
or printable keyboard key.
Used to ensure a given char
constant is used literally. For
example,
Print '\''
will enter a single quotation mark into
the log file.
Default Types for Constants
If a suffix is not provided, the following table lists the default types:

Constant Default type
'x' Char
123 Long
4.56 Double
0xABC DWord
Comments
Since any numeric type is automatically converted to any other numeric type as needed, there are few situations where
suffixes are really required. In ATEasy the constants used or initial values do not have to have the same type as the
variable being initialized. The only requirement is that the assignment statement variable constant is legal.
For the array and structure initial values, it must be legal to assign each value provided with the corresponding array
element or struct field. For example, given
adX ! Double [3]
then {'A', -3, 0xABCD} is a legal initial value.
Examples
Decimal literal:
To specify a decimal literal, begin the specification with a numeral. For example:
i = 157 ! Decimal literal
Hexadecimal literal:
Literals
37
To specify a hexadecimal literal, begin the specification with 0x, followed by a sequence of numerals in the range 0
through 9 and a (or A) through f (or F). Hexadecimal numerals a (or A) through f (or F) represent values in the range 10
through 15. For example:
i = 0x3fff ! Hexadecimal literal
j = 0X3FFF ! Equal to i
Binary literal:
To specify a binary literal, begin the specification with 0b, followed by a sequence of numerals in the range 0 through 1.
For example:
i = 0b1001001 ! Binary literal
j = 0x49 ! Equal to i
k = 73 ! Equal to i
Unsigned types:
To specify an unsigned type, use the u suffix. To specify a long type, use the l suffix. For example:
uVal = 328u ! Unsigned value
lVal = 0x7FFFFFl ! Long value specified as hex literal
ulVal = 0776745ul ! Unsigned long value
ASCII characters or escape sequences:
To specify a single ASCII character or Escape Sequence, surround the constant by single quotation marks ('):
'a', '\n', '\x0A'
See Also
Escape Sequences, Floating Point Literals
Floating Point Literals
Floating point literals specify values that must have a fractional part. These values contain decimal points (.) and can
contain exponents. There are two floating point literals in ATEasy:
Float (for example, 3.56f, -3.4E-38f)
Double (for example, 3.56 or 3.56d)
The following table summarizes these two types of floating point literals:

Type Value range
Magnitude range Suffix
Examples
Float 3.4E +/- 38 (7 digits)
Magnitude range of +/-
1.2E -038.
f
3.56f, -3.4E-38f, or 3.f
Double 1.7E +/- 308 (15 digits)
Magnitude range of +/-
2.3E -308.
optional
letter 'd'
1.7E+308, 3.56d, 3.56, or
3.
Syntax
mantissa [optional exponent] suffix
ATEasy Programming Language
38
The syntax has the following parts:

Name Components Description
mantissa A sequence of numeral digits (0-9), plus a
period, plus an optional series of numeral
digits(0-9).
The value of the number. If the value is
positive, the plus sign is optional.
exponent The character e or E (either case may be used),
plus a positive or negative numeral (0-9).
The magnitude of the number as a power
of 10. If the magnitude is positive, the
plus sign is optional.
suffix This can be f for a Float or d for a Double. A character specifying the type of float
literal constant. The suffix d is optional
for the Double floating point literal.
Comments
The exponent, if present, specifies the magnitude of the number as a power of 10, as shown in the following example:
18.46e0 ! is the same as 18.46
18.46e1 ! is the same as 184.6
If an exponent is present, the trailing decimal point is unnecessary in whole numbers such as 18E0.
Floating-point constants default to type double. By using the suffixes f or l, the constant can be specified as float or
double, respectively.
See Also
Integer Literals
String Literals
String literals consist of a sequence of zero or more ASCII characters or escape sequences surrounded by double
quotation mark (").
String literals can be typed in multiple lines as shown here:
s="abc""def" \
"ghi"
which is same as s="abcdefhi". '\' is the continuation character which allows.
If the 'L' suffix is added to the string literal, the result is a BString (Unicode). The conversion takes place after the ASCII
string is scanned. Thus the \xhhh escape sequences can only represent 8 bits of data, not 16. Unicode characters which
do not have a single byte ASCII representation need to be specified by a Multi-Byte Sequence as defined by Microsoft.
An escape sequence represents a single character (one byte), and can be any of the following:

Escape Sequence Character Name Value
\a Bell 7
\b Backspace 8
Literals
39
\f Form feed 12
\n Newline (Line feed) 10 or 0xa
\r Carriage return 13 or 0xd
\t Horizontal tab 9
\v Vertical tab 11
\' Single quotation mark 39 or 027
\" Double quotation mark 34 or 022
\\ Backslash 92 or 05c
\xhhh Hexadecimal number 0xhhh
\c where c is any
character not found
above
Character or numeral That character, for example,
the letter c.
For more information on escape sequences, see Escape Sequences for Literals.
Syntax
"string" [optional suffix]
The syntax has the following parts:

Name Type Description
string string constant A sequence of zero or more ASCII characters or escape
sequences surrounded by double quotation mark (").
suffix suffix The letter "L".
Comments
In ATEasy, the convention for naming string variables is to prefix the variable name with an 's' or 'bs', for example,
sStringVar.
Example
The following are two examples of string literals:
"First line\nSecond Line\n"
"\x0ASurounded by line feeds\x0A"
See Also
Escape Sequences for Literals, Integer Literals
Array and Struct Literals
The value of an array is made up of the value of the individual array elements and the value of a struct is made up of the
individual fields. A two-dimensional array is an array of arrays, a three-dimensional array is an array of arrays of arrays,
etc. The elements of an array can be a struct and a field in a struct can be an array.
ATEasy Programming Language
40
An array or struct literal is called a complex literal and consists of an open (left) brace, a list of element or field values
separated by commas and a closing (right) brace. For example, the following is an assignment statement to set the value
of an array of 3 Floats:
afX = {1.2, 3.45, 6.789}
and the following sets the value of a struct with four fields (Char, Double, String, Long);
usY = {'A', 3.14159, "xyz", 98765}
If the components of a complex literal are in turn complex literals, for example, an array of arrays or a struct with a field
which is an array, the constants for each component follow the same syntax (open brace, list of values, close brace). This
format can be nested as many levels as needed to match the data type definition. For example a 2 by 3 Short array could
be set as follows:
an23 = { {101, 102, 103}, {201, 202, 203} }
and a struct with three fields (Char, array of 3 Shorts, Double) could be set as follows:
us2 = {'Z', {1,2,3}, 4.5678}
It is not necessary that the apparent type of the literals match the elements of the complex data type exactly. As long as
the literal is assignment compatible with the type of the corresponding array element or struct field, the literal will be
converted to the required type. For example, the following two arrays of 3 Floats each end up with exactly the same
values:
af1 = {1,2,3}
af2 = {1.0, 2.0, 3.0}
See Also
Array Data Type, Arrays of Structs
Escape Sequences for String Literals
An escape sequence is a sequence of keystrokes or output characters that begins with the ESC character. Escape
sequences are typically used for positioning the cursor and controlling the display of text on the screen, or as codes to
control printers.
An escape sequence represents a single character (one byte), and can be any of the following:

Escape Sequence Character Name Value
\a Bell 7
\b Backspace 8
\f Form feed 12
\n Newline (Line feed) 10 or 0xa
\r Carriage return 13 or 0xd
\t Horizontal tab 9
\v Vertical tab 11
\' Single quotation mark 39 or 027
Literals
41
\" Double quotation mark 34 or 022
\\ Backslash 92 or 05c
\xhhh Hexadecimal number 0xhhh
\c where c is any
character not found
above
Character or numeral That character. See
"Comments" below for "any
character".
Comments
Note: For any character, normally you would just type the character without the backslash. For example, to get the letter
'n', just type the letter without the backslash.
Example
To add to your log file the following:
This is an "ATEasy" test.
use this:
Print "This is an \"ATEasy\" test."
See Also
String Literals

43
Data Conversion
Logical and Bitwise Data Conversions
Logical/bitwise Operators (and the IF statement)
If the statement is a simple IF statement, such as:
IF ( x )
then ATEasy returns a logical (boolean) result.
If the operator is one of the following:
and, not, or , xor,
then ATEasy expects either a logical operand or a bitwise operation.
If the operands are all numeric, ATEasy will perform the operation in bitwise mode. For
example:
IF (nShort and lLong)
If both operands are objects and the operator is equals (=), then ATEasy checks to see if
they reference the same objects and returns a boolean result. For example:
If (obX1 = obX2) ! Result is boolean
If both operands are procedures and the operator is equals (=), then ATEasy checks to
see if they reference the same procedures and returns a boolean result.
If (Proc1 = Proc2) ! Result is boolean
If one of the operands is either a Boolean, procedure, or object, the operand is first
converted to a Boolean and ATEasy performs a logical operation with a Boolean result. If
the operand is a procedure or an object, it becomes False if the procedure or object has
not been set; or it becomes True if it points to a valid procedure or object that is not
empty. For example, ATEasy evaluates the following statement to mean the programmer
is looking to see if both objects exit:
IF (obA and obB)
If one of the operands is a Variant, ATEasy encounters a Variant, it assumes that the
result is a bitwise operation and starts evaluating the result in bitwise mode. For example:
vOne=0x05 ! vOne is declared as Variant, bit value 0000 0101
vTwo=0x10 ! vTwo is declared as Variant, bit value 0001 0000
bA=vOne ! bA is declared as Boolean
bB=vTwo ! bB is declared as Boolean
IF (bA and bB) ! is evaluated to True.
If (vOne and vTwo) ! is evaluated to False.

ATEasy Programming Language
44
Numeric Data Conversions
Numeric Operators
If the operator is one of:
+, -, *, /, div, =, <, >, <=, >=, <>, mod, -(negation), shl, shr,
then ATEasy expects a numeric operand. It will convert the variables automatically to the most extended variable type.
For example, if nX is a Short variable:
nA=2 ! Short variable
dB=12.8345 ! Double variable
nX=nA+dB ! Outcome is a Short variable
then nA is temporarily converted to a Double, added to dB, and the resultant 14.8345 is then converted to Short
(truncated) to become 14. If the outcome had been declared as Double, the result would have been 14.8345 instead.
If you used a Boolean bC:
bC=True ! Boolean variable
nA=2 ! Short variable
nX=nA+bC
Then bC would be converted to numeric (-1) before the results are calculated and nX would become 1.
Note: When converting a signed numeric to a more extended numeric, the value is "sign extended" to retain the correct
signed value.
Currency and DateTime Data Conversion to String Data Type
The numeric data value of types Currency and Datatime can be set to a string and vice versa. For example,
dtToday="9/20/2007"
dtCurTime="1:51:08 PM"
dtCurDateTime="12/26/2007 10:30:00 AM"
sDate=dtToday
sTime=dtCurTime
sNow=dtCurDateTime

curProfit="$30000"
s=curProfit
print s ! this prints "$30,000.00"

Rules for Numeric Data Conversions
If either operand is of a more extended type, the other operand is converted to that type, from the most extended to the
least extended, as shown in the table below:

Order of "most extended" to "least
extended" data types
Currency
Data Conversion
45
DateTime
Double
Float
DDWord
DLong
DWord
Long
WChar
Word
Short
Byte
Char
Note: if you attempt a numeric operator on a procedure or object variable, you will get a fatal error message, since these
cannot be converted to true numeric values. Even though procedure and object variables are pointers (numeric) to the
addresses of their contents, there is no meaning in performing numeric operations on them.
Type Promotion
Sometimes, intermediate calculation values can exceed their data type maximums. When this occurs, ATEasy will
convert the data type to another data type or "promote" the result to a higher capacity data type, in order to complete the
calculation. For example,
nA=20,000 ! Short variables nA, nB, nC, and nD
nB=30,000
nC=2
nD=(nA+nB)/nC
The intermediate value "nA + nB" exceeds the 32,767 for a Short variable. ATEasy will temporarily convert that value to
Long in order to complete the calculation and will then convert the final result to the data type of nD (Short). If the final
result still exceeds the maximum of nD (as would occur if nC=1), the result is truncated.
Conversion Functions
ATEasy provides the following conversion functions:

Functions Description
Val Converts a string value to a numeric.
Str Converts a numeric value to a string.
See Also
Basic Data Types, String Data Types
ATEasy Programming Language
46
Character Data Conversion
Version 5

ATEasy allows character data conversion through assignment; namely, a byte or char array can assign to String or vise
versa.
For example, if aByteArray is an array of bytes of size 10, aCharArray is an array of characters of size 10, and sString is
of type String, the following assignments are allowed:

sString="abc"
sByteArray=sString ! now aByteArray contains "abc"

sString="test string"
aCharArray=sString ! now aCharArray contains "test strin" - only
10 characters copied
If the size of array is shorter than the string length, the string will be truncated. Notice only 10 characters are copied in the
second example above.
Structs/Variants Data Conversion
Version 5
ATEasy allows complex data conversion between structures and Variants through assignment; namely, you can assign a
structure to a variant and vice versa.
First you can assign a structure to a variant. Then assign the variant back to a structure of same type. Internally the
structure is converted to an array of variants, each variant element being each corresponding structure field. For further
detailed information see Assigning Structs to Structs or to Variants.
Example
In the following example, we have an array of variants. The first variant element is set to a structure, stUsersTag. Then
to users.Tag we assign the array.
avInfo[0]=stUsersTag ! assigning Structure to Variant
users.Tag=avInfo
To retrieve the info,
avInfo=users.Tag
stUsersTag=avrInfo[0] ! assigning Variant back to Structure
Comment
This conversion is useful for storing struct information into a variant. ATEasy implementation of this conversion allows
you to modify (add or delete) the structure without error as long as they are appended/deleted at the end of the structure
definition.
C/C++ and ATEasy Data Types
Version 7
The following table shows C/C++ equivalent data types to ATEasy types. This conversion is used to export C header file
for ATEasy Dll. Note that Types in C are case sensitive.

Data Conversion
47
ATEasy Data Types
C/C++ Data Type
Char
char
Byte
unsigned char
Short
short
Bool
short (VARIANT_BOOL - Microsoft)
Word
unsigned short (WORD - Microsoft)
WChar
unsigned short (WCHAR - Microsoft)
Long
long
DLong
longlong
DWord
unsigned long
DDWord
unsigned longlong
Float
float
Double
double
Currency
CY (Microsoft - wtypes.h)
DateTime
double (DATE - Microsoft - wtypes.h)
String
LPSTR
BString
LPCWSTR
Variant
VARIANT
Procedure
void *
Object
LPUNKNOWN
Any
LPVOID

ATEasy Programming Language
48
Visual Basic and ATEasy Data Types
Version 7


The following table shows VB .Net equivalent data types to ATEasy types. This conversion is used to export VB header
file for ATEasy Dll.

ATEasy Data Types
Visual Basic .Net Data Type
Char
SByte
Byte
Byte
Short
Short
Bool
Boolean
Word
UShort
WChar
Char
Long
Integer
DLong
Long
DWord
UInteger
DDWord
ULong
Float
Single
Double
Double
Currency
Long
DateTime
Date
String
String
BString
String
Data Conversion
49
Variant
Object
Procedure
"Declare sub/function" statement
Object
Object
Any
Integer


51
Procedures
Procedures Overview
A procedure is a set of instructions that works as a unit and can be called from a test or another procedure. A procedure
contains a name and description, parameters and variables, programming code, and a return value.
Overall ATEasy provides the following five types of procedures:

Type of
Procedure
Description Resides in See Also
User-Defined
Procedures
Created by you. You can change the
parameters, local variables, and code.
Program, System, Driver,
Forms
About User-Defined
Procedures
Module Events Called when special events occur. You
can change only the code and local
variables. Parameters are fixed.
Modules (Program, System,
Driver) and Submodule
(Forms, Controls, and Menus)
Module Events
Dynamic Link
Library (DLL)
Procedures
Defined by you to describe a
procedure and parameters that reside
in an external library.
DLL Library Using Dynamic Link
Libraries
I/O Tables Used to send, receive, and control
external devices. You define the name
and operations, such as send or
receive. The parameters are implied
from the operation.
Driver I/O Tables Submodule IO Tables
COM
Methods/Procedure
Is part of a COM Library in a COM
class. The COM method has
predefined properties. The procedure
or methods definition is imported from
a type library.
External Type Library Classes,
Properties,
Methods, and
Events
For more information on how to use procedures, see the following topics:

Procedure Parameters Calling Procedures
Returning Values in Procedure Code Declaring the Return Type
How ATEasy Searches for Procedures Compatible Argument Types
Procedure Parameters
Parameters are variables that hold arguments passed to the procedure when the procedure is called by a procedure call
statement from a procedure or a test. Parameters can be declared as Val or Var, that is, a parameter's argument may be
passed by value or by reference. An argument is a variable that is passed to a procedure.
Defining a Procedure Parameter
You can define a parameter in the Variables Properties window:
1. Click in the Variables View of the Procedures View to add a variable to the procedure.
2. Right-click and select Insert Object After from the context menu.
3. Click on the new variable. Right-click and select Properties from the context menu to
display the Variables Properties window. For more information, see Variables Properties
Window.
ATEasy Programming Language
52
4. Click the Parameter pull-down menu in the Variables Properties window.

Select one of the following parameters:
Val The parameter is a local variable which is set to the value of the passed argument
when the procedure is called.
Since the Val parameter is a local variable, any changes made to that parameter in the
procedure do not affect the original argument value. The passed argument expression must
be such that parameter = argument is a legal assignment statement.
Select the Optional checkbox to make this parameter optional. Optional indicates that the
argument may be omitted when the procedure is called.
Var The parameter is a reference to the passed argument.
References to the parameter in the procedure are references to the passed argument.
Therefore any changes made to that parameter in the procedure affect the original
argument value.
The general rule is that the type of the passed argument must match the type of the
parameter. The exceptions are :
o An argument of any type can be passed to a Any or Variant parameter.
o An argument of any enumerated type can be passed to a Long parameter.
For a list of compatible data types for Val or Var parameters, see Compatible Argument Types.
Array Parameters
For parameters, which are arrays, you can only specify the number of dimensions in an array, such as a one or two-
dimensional array, not the size of each dimension.
For a Var parameter that is an array, the argument must be an array of a data type compatible with the specified number
of dimensions.

Argument and Parameters Types
The following table lists the compatible data types for variables used as parameters that are passed by Val or Var.

Parameter Type as
Declared Inside the
Procedure
Compatible Val
Argument Type
Compatible Var
Argument Type
Any numeric type
Any numeric data type,
Variant
Same numeric type
Procedures
53
String or BString
String, BString, Variant
Same String or BString
Object
Object, Variant
Object
Procedure
Procedure
Procedure
Variant
Any data type (that can be
stored in Variant type)
Any data type (that can be
stored in Variant type)
Any
Any data type
Any data type
The following is an example of passing an argument to a Val parameter of a procedure. When an argument is passed to a
Val parameter, the effect is identical to an assignment statement with the value parameter on the left side and the
argument expression on the right side.
The argument expression is converted to the data type of the parameter as necessary.
For example, if ProcedureA expect its first parameter to be a Double variable:
ProcedureA(dDouble,...)
And if you call ProcedureA as follows:
ProcedureA(17,...)
Then the argument value of 17 will be converted to the Double ( 8-byte real ) value of 17.0 and assigned the parameter
dDouble.
For more information on Val or Var parameters, see Procedure Parameters.
Declaring the Return Type
You can define whether a procedure returns a value in the Procedure Properties window. The return type is used with the
return statement that you place in the procedure code.
To display the Properties window, select the procedure in the Tree View. Right-click and select Properties from the
context menu.
To define what type of value a procedure returns:
A procedure that does not return a value is called a subroutine. Define the return type of
this procedure as Void.
A procedure that returns a value is called a function. Define the return type of this
procedure with the same data type as the returned variable.
For example, if you expect to return a boolean value, declare the return type as Bool. Next return the value by using the
Return statement in the procedure code as explained in Returning Values in Procedure Code.
In addition to returning a value to the caller, a procedure can use Var parameters to return or change a value of a variable
argument passed to the procedure. For more information, see Procedure Parameters.
For more information on the Procedure Properties window, see Procedure Properties Window.

Returning Values in Procedure Code
If you want a procedure to return a value, make sure that:
ATEasy Programming Language
54
The procedure return type is defined. For more information on return type, see Declaring
the Return Type.
The Return statement is used in the procedure code.
The following example returns the value of x or y with the Return statement.
if X < Y
return X
else
return Y
endif
For more information on how to write procedure code, see Entering Code.
For more information on how to call procedures, see Calling Procedures.

Calling Procedures
You call a procedure by specifying the procedure name and its parameters.
1. Before you can insert a user-defined command as code, make sure you are in one of the
following Code views where programming code can be entered to call the procedure:
Procedure Code View
Tests Code View of a program
2. Click in the Code View of the Procedures View and enter the programming code to call
the procedure.
The following example shows how the Max function, a user-defined procedure, is tested. The Max function returns the
maximum number of any given two numbers.

The test code in the Tests Code View above uses an array of type long (alArray) to hold 20 items (long integers). The test
array, alArray, is set to the numbers zero to 19.
The Max procedure tests the code. It is used to compare the items in the array to determine which value is greater, to
store the result as d, and then to return the greater value.
Procedures
55
The TestStatus part of the code verifies that the result is as expected. If the result is not equal to 19, the highest value,
then the test fails.
To call the result (d), you can use the following example code:

d=Max(1,10)

print d !This will print 10.
For information on entering programming code, see Entering Code.

How ATEasy Searches for Procedures
You can call a procedure from a procedure or test code in the Program, System, and Driver modules or within a Form
procedure. When a procedure name is called, ATEasy will search for the procedure to locate where it is defined.
Since procedures in different modules (or even in different submodules of the same module) can have the same name,
ATEasy must decide which procedure is being referred to in the current code statement. ATEasy follows a specific
search sequence and the first procedure that ATEasy finds with the given name will be used.
To bypass the way ATEasy searches for a procedure, you can also use the Scope Resolution Operator to specify where
the procedure is defined. For example, 'Program.Average' is ModuleName.ProcedureName using Scope Resolution
Operator rules. For more information, see Member Operator ('.') and Scope Resolution Operator.
How ATEasy searches for a procedure is important because procedures defined in a Program, System or Driver module,
or within a Form can have the same name.
In general ATEasy will first search for a procedure in the current module, the module where the procedure is used, in the
following order:
If the procedure is used in a control event, ATEasy searches in the Control methods or
properties.
If the procedure is used in a Form Procedure or Event, ATEasy searches in the Form
procedures first, then the Form properties or methods.
ATEasy then looks in the module procedures, module COM libraries procedures,
properties, and methods.
If the procedure is not found, ATEasy will then search for public procedures that are visible in other modules as follows:
If the current module is a Program module, ATEasy searches in the System module and
then in the System Drivers (starting from the last driver to the first).
If the current module is a System module, ATEasy searches in the System Drivers
(starting from the last driver to the first).
If the current module is a Driver module, ATEasy searches in the System Drivers
(starting from the last driver to the first).

About Module Events
The Program, System, and Driver modules contain built-in module events that are called when special actions occur, such
as when a task is started (OnInitTask event) or ended (OnEndTask event). This chapter describes module events and
includes the following topics:

Topic Description
ATEasy Programming Language
56
Overview of Module Events An introductory explanation of module events.
Using Module Events Describes how to use module events.
Module Events View Describes how to view module events.
Order of Module Events Describes the calling sequence of module events
Initialization Events Describes the purpose of OnInit events, and explains when they are called in
ATEasy applications.
End Events Describes the purpose of OnEnd events, and explains when they are called in
ATEasy applications.
Reset Events Describes the purpose of OnReset events, and explains when they are called
in ATEasy applications.
Abort Events Describes the purpose of OnAbort events, and explains when they are called
in ATEasy applications.
Error Events Describes the purpose of OnError events, and explains when they are called
in ATEasy applications.
OnInterface Event
Describes how a change in condition in a driver interface can trigger an
OnInterface Event.

About DLLs
This section contains information about using dynamic link libraries (DLLs) in ATEasy applications, and includes the
following topics:

Topic Description
Using Dynamic Link Libraries
(DLLs) with ATEasy
An overview of how DLLs are used with ATEasy.
When to Use DLLs in ATEasy
Applications
Description of when to use DLLs in ATEasy applications.
Inserting a DLL Instructions on inserting a DLL into an ATEasy application.
Importing DLL Functions and
Data Types from C Header files
How to import DLL functions and data types from a C language hedaer file (.h)
Setting DLL Properties Instructions on setting DLL properties.
DLL Submodules Descriptions of the DLL submodules.
Declaring DLL Procedures Instructions on declaring a DLL procedure.
Setting DLL Procedure
Properties
Instructions on setting DLL procedure properties.
Using Aliases and Ordinals
When Declaring DLL Procedures
Information on using aliases and ordinals in DLL procedure declarations.
Defining DLL Procedure
Parameters
Instructions on defining DLL procedure parameters.
Procedures
57
DLL Procedure Parameter Types Descriptions of DLL procedure parameter types.
Using Commands with DLL
Procedures
Information on creating user-defined commands for use with DLL procedures.
Distributing a DLL Information on distributing a DLL with an ATEasy application.
About the DLL Examples Examples of DLL usage in ATEasy applications.
Dynamic Loading of DLLs (v 7) LoadLibrary (and UnloadLibrary) statements are allowed to load and unload DLL
during run time.

About I/O Tables
This chapter provides details on I/O Tables in ATEasy. The following topics contain information on the creation, operation,
and functions of I/O tables.

Topic Description
I/O Tables Overview What I/O Tables are, how to create them, the I/O properties, and how to use Monitor
Window.
Defining I/O Table
Operations
How to view or set the properties of an I/O Table.
Assigning an I/O Table to a
Command
How to assign an I/O Table to a command.
Using I/O Tables How to call an I/O Table.
Examples Examples of I/O Table use.

Classes, Properties, Methods, and Events
Type libraries or .NET assemblies (libraries) can contain classes. Class contains methods, properties and events that can
be called by ATEasy or by the program code. The ATEasy internal library contains many classes. External library inserted
to your module can also contains classes. To use a class an object which is an instance of the class must be created and
assigned to a object variable. Object usually created using the CreateObject or the new operator. The internal library
contains many objects (such as : System, Log, Program Test etc) that are created by ATEasy when the application is
started.
Classes
A type library can contain many classes. For example, the Microsoft Excel object library lists dozens of classes, each of
which describes a different Excel object. If you wanted to use Excel components in your ATEasy application, you would
insert the Microsoft Excel object library below your application's Libraries sub-module so that you could reference these
components at design time. Here are a few of the classes listed in the Excel object library:

Excel class Description
Application The application class describes the Excel application.
Assistant The Assistant class describes the Microsoft Office Assistant,
which provides online help.
ATEasy Programming Language
58
Chart The Chart class describes the Excel chart object.
Worksheet The Worksheet class describes the Excel worksheet object.
Properties
A property is an attribute of an object. For example, the Microsoft Excel Worksheet class lists properties that could be
attributes of specific worksheet objects. Some Excel worksheet properties are listed below:

Worksheet Class
Property
Description
PageSetup Defines the page orientation, paper size, margins, and other
attributes of the worksheet page.
HPageBreaks Defines the horizontal page breaks on the worksheet.
VPageBreaks Defines the vertical page breaks on the worksheet.
DisplayPageBreaks A Boolean value. When true, page breaks on the worksheet
are visible.
Methods
A method is a function or action that an object can perform. For example, the Microsoft Excel Worksheet class lists
methods that could be performed on specific worksheet objects. Some Excel worksheet methods are listed below:

Worksheet Class Method Description
Activate Activates the worksheet.
CheckSpelling Checks the spelling of words on the worksheet.
Copy Copies the worksheet.
Delete Deletes the worksheet.
Events
An event is a procedure that is called by the ATEasy run-time when some action occurs on the object. For example when
a user click on a button the OnClick event procedure if defined in the form is called, the user can place code in the
OnClick of the button to perform specific operation. In ATEasy, several object have events including AProgram, ASystem,
ADriver, AForm and form controls such as the AButton.




59
COM Objects
Early Binding and Late Binding
In order for an ATEasy application to use a software component, it must learn about the objects exposed by that
component. The process by which one application queries another to learn about its objects, methods, and properties is
called binding. Early binding occurs when this querying is accomplished at design time, when the code is written, by a
reference to a type library. Late binding occurs when this querying is accomplished by a call to the component at run time.
Most components support both early and late binding and are therefore referred to as dual-interface components.
The main advantage of early binding over late binding is improved performance for your application. ATEasy applications
that use type libraries get access to specific and complete information about an Automation object at design time. The
ATEasy application can use this information to declare object variables as types that are specific to that object. Because
early bound applications use specific variable declarations, they have better run time performance than late bound
applications.
Another advantage of early binding is that the ATEasy compiler can check the syntax and content of the calls to the
methods and properties of the objects. This compile time checking reduces the potential for errors at run time.
Early Binding
To bind to an application's component using early binding, add the appropriate type library to your ATEasy application
and refer to the objects, properties, and methods described by the type library as needed. Early binding uses a vtable, a
virtual table containing the addresses (pointers) for the methods and properties of each Automation object, to perform
syntax checking. For instructions on adding a type library to an application, see Inserting a Type Library.
Late Binding
If your ATEasy application uses late binding, it queries the component at run time rather than design time. No type library
is used. Because the late bound application doesn't have access to the type information about Automation objects that is
contained in a type library, it declares object variables using the generic Object or Variant type rather than data types that
are specific to the Automation object. All method and property parameters and their return values are converted to or from
the Variant type. The Object type supports the IDispatch interface, a COM interface that provides a way to use an object's
properties and methods without having any type information about the object.
Late bound applications must do more work at run time than early bound applications, and their performance suffers by
comparison. Late binding is appropriate when you need to implement automation with applications that do not support
early binding, or when the ATEasy application will not know until run time the type of the object.

Creating Objects
You can use early binding or late binding to create instances of Component Object Model (COM) objects so that you can
use them in ATEasy applications. Using late binding, you create COM objects that are defined by a variable declaration of
type Object. Using early binding, you create COM objects that are defined by a variable of a type that is specific to the
object.
Creating Objects Using Late Binding
To create an instance of a COM object using late binding, first declare a variable (for example, a variable named "ob") and
define its type as Object.
ob = CreateObject("Excel.Sheet")
Declaring a variable as an Object type creates a variable that can contain a reference to any type of object. However,
access to the object through that variable is late-bound; that is, the binding occurs when your program is run.
ATEasy Programming Language
60
The CreateObject function must provide the object's registered name or PROGID. The PROGID is the name of the
object's class. In the example above, the PROGID is "Excel.Sheet." At run time, when ATEasy executes this statement, it
locates the PROGID entry in the Windows registry, and thus gets access to the class information that it needs to create an
instance of the object. The assignment operator ("=" in the example above) also queries the class to make sure that it
supports the IDispatch interface, the COM interface supported by Object types. Once these processes have completed,
ATEasy starts the application and creates the object, in this case an Excel spreadsheet. Once an object is created, you
reference it in code using the object variable you defined.
Creating an Object Using Early Binding
To create an object variable that results in early binding, that is, binding when the program is compiled, declare the object
variable with a specific class type. In order to use a specific class type, you must have added to your application a type
library containing that class. For example, you can declare and create the following Microsoft Excel references:
First declare the variable named xlApp to be type Excel.Application. Declare the variable xlwbs as type Excel.Workbook.
xlApp = CreateObject("Excel.Application")
xlwbs = xlApp.Workbooks.Add
When an object, such as that returned by the Add method above, is assigned to an object variable of a specific type, such
as xlwbs above, at run time the application calls the Query interface to verify that the object really is of the type declared.
Using an object inside a type library through the early-bound variable can give better performance, but can refer only to
the class specified in the declaration.
You can pass an object returned by the CreateObject function to a function expecting an object as an argument. For
example, the following code creates and passes a reference to an Excel.Application object:
MySub(CreateObject("Excel.Application"))
Note: Use CreateObject when there is no current instance of the object. If an instance of the object is already running, a
new instance is started and an object of the specified type is created. To use the current instance, or to start the
application and have it load a file, use the GetObject function.
If an object has registered itself as a single-instance object, only one instance of the object is created and returned, no
matter how many times CreateObject is executed.

Getting Objects
To access an ActiveX object from a file, first declare a variable in ATEasy or use a variable previously declared with the
CreateObject function. Then assign the GetObject function to that variable:
obCAD = GetObject("C:\CAD\SCHEMA.CAD")
When this code is executed, the application associated with the specified pathname is started and the object in the
specified file is activated.
If the pathname is a zero-length string (""), GetObject returns a new object instance of the specified type. If the pathname
argument is omitted, GetObject returns a currently active object of the specified type. If no object of the specified type
exists, an error occurs.
Some applications allow you to activate part of a file. When working with these applications, you can add an exclamation
point (!) to the end of the filename and follow it with a string that identifies the part of the file you want to activate. For
information on how to create this string, see the documentation for the application that contains the object.
For example, in a drawing application you might have multiple layers in a drawing stored in a file. You could use the
following code to activate a layer within a drawing called SCHEMA.CAD:
obLayer = GetObject("C:\\CAD\\SCHEMA.CAD!Layer3")
COM Objects
61
If you do not specify the object's class, Automation determines the application to start and the object to activate based on
the filename you provide. Some files, however, may support more than one class of object. For example, a drawing might
support three different types of objects: an Application object, a Drawing object, and a Toolbar object, all of which are part
of the same file. To specify which object in a file you want to activate, use the optional class argument. For example, you
may declare a variable called obDrawing as an Object type and then assign the GetObject function to it:
obDrawing = GetObject("C:\\DRAWINGS\\SAMPLE.DRW", "FIGMENT.DRAWING")
In the example, FIGMENT is the name of a drawing application and DRAWING is one of the object types it supports.
FIGMENT.DRAWING is the registered name or program ID (PROGID) that identifies the object in the Windows registry.
Once an object is activated, you reference it in code using the object variable you defined. In the preceding example, you
access properties and methods of the new object using the object variable obDrawing. For example:
obDrawing.Line (9, 90)
obDrawing.InsertText (9, 100, "Hello, world.")
obDrawing.SaveAs ("C:\\DRAWINGS\\SAMPLE.DRW")
Note: Use the GetObject function when there is a current instance of the object or if you want to create the object with a
file already loaded. If there is no current instance, and you don't want the object started with a file loaded, use the
CreateObject function.
If an object has registered itself as a single-instance object, only one instance of the object is created, no matter how
many times CreateObject is executed. With a single-instance object, GetObject always returns the same instance when
called with the zero-length string ("") syntax, and it causes an error if the pathname argument is omitted. You cannot use
GetObject to obtain a reference to a class created with ATEasy.

Using Properties
A property is an attribute of an object. After you have added a type library to an ATEasy application, you can use the
properties of the objects that it exposes. The syntax for getting a property value is:
Object.Property
The line of code below shows an example of getting a property value:
print ob.Caption
Some properties are read-only, in which case you can only retrieve or get their values. Other properties are writable,
which means that you can set their values. The syntax for setting the value of a writable property is:
Object.Property=value
The values that you can set for a property depend on its type. For example, properties that are of type string take string
values, while properties that are of type Bool can be set to TRUE or FALSE.
For example, the Microsoft Excel Worksheet class lists properties that could be attributes of specific worksheet objects. In
the code sample shown below, two statements contain property settings:
xlapp.Visible=TRUE
xlapp.Caption="ATEasy Excel Demo Using Early Binding"
In the first line, the Visible property of the Excel Application object is set to TRUE, meaning that the Excel main window
will be visible to the user. If this property were set to FALSE, no Excel components would be visible to the user. In the
second line, the Caption property of the Excel Application object is defined as a string. This string will appear in the
application's window bar as shown below:
Properties can also have parameters. For example, in the line of code below, an Excel Chart object uses the Axes
property, which in turn uses the Caption parameter:
ATEasy Programming Language
62
cht.Axes(1).Caption = "Hello"

Calling Methods
After you have created an object, you can call the methods exposed by it. A method is a function or action that an object
can perform. For example, the Microsoft Excel Workbooks class lists methods that could be performed on specific
workbook objects.
The syntax for calling a method in ATEasy is:
Object.Method ([param1[,...]])
The second line of the code sample shown below contains a call to a method:
xlapp=CreateObject("Excel.Application")
xlapp.Workbooks.Add()
This test code uses the xlapp variable, which was previously declared as type Excel.Application. This code starts the
Excel application, sets the application to be visible and defines the caption on the Excel window. The last line of the code
adds an instance of an Excel workbook by calling the Add method of the Workbooks object.

Deleting Objects
After you have created an instance of a Component Object Model (COM) object, you can delete the object when it is no
longer being used. Deleting the object frees system resources.
Each object has a counter that tracks the number of variables that refer to it. Only when this counter equals 0 can the
object be deleted. So, to delete an object you must destroy all variables that refer to that object. For example, in the code
below, ob1 is a variable that refers to ob:
ob1 = ob
ob = Nothing ! object not destroyed
ob1 = Nothing ! object destroyed
Note that all objects are automatically deleted when the application ends or when the program is aborted.


63
Scope
Scope Operator and Scope Rules
This chapter describes how to use the Scope Rules, the Scope Resolution Operator, the Member Operator, and public
members. It contains the following topics:

Topic Description
Scope Rules Describes the order in which ATEasy searches to find variables.
Scope Resolution Operator Describes how the Scope Resolution Operator names an identifier defined in a
module, library, or enumerated data type.
Member Operator Explains how the Member Operator is used to access members of an object or a
structure.
Public Attribute Describes how a public attribute allows an identifier to be used from other modules.
Public Members Describes public members of a system, driver, submodule, procedure, variable, or
event.
Scope Rules
ATEasy allows the same identifier to be used for variables in different procedures, forms, and modules. The advantage is
that portions of a large project can be developed independently because developers do not need to know all the other
locations where the same identifier is used. The scope rules describe the order in which ATEasy searches to find the
variables with a given identifier.
If you use a qualifier with your variable, ATEasy can find the exact variable in question. In the example,
Form1.MyVariable, Form1 is the qualifier to describe the name of the form within which MyVariable is contained.
A scope qualifier is used to specify exactly how the identifier is intended to be used. For example, if the scope qualifier is
"X.," the prefix X can be the driver name or name of one of the keywords, such as System, Driver, Program, Form,
Control, or Menu.
All scope issues look upward for their resolution. If a variable is not found within a local procedure or event, ATEasy then
looks in the container of that procedure or event. For example, if you have a procedure within an event, and a variable
referred to in the event handler is not found at the level of the event, ATEasy then looks upward to the container of that
event, whether that container is a control or the form. The next step up from the form would be the enclosing module, the
Program, or the System. Once the search reaches the module level, ATEasy can look in libraries, such as the internal
library, which is common to all modules.
If the variable name still has not been resolved, ATEasy starts looking in the Drivers. Driver scope rules differ from
program scope rules. ATEasy searches the Drivers for public items that will resolve the variable name, but it does so in
the reverse order from the order in which the Drivers were loaded.
Driver scope rules behave this way because high-level Drivers can refer to low-level Drivers, which need to be loaded
first. Within the Drivers, ATEasy returns the first matching name it finds. ATEasy does not continue to find other matches,
even if they exist.
Scope Resolution Operator ('.')
The Scope Resolution Operator names an identifier defined in a module, library, or enumerated data type.
Syntax
[ModuleName.][LibraryName.][enumName.]VariableName
ATEasy Programming Language
64
Where

Syntax Component Description
ModuleName Can be a Program or Systems or Driver Name.
LibraryName Is a COM or DLL library inside a module.
enumName Is an enumerated type defined in a module or library Types submodule.
VariableName Is the identifier being named.
Comments
When you use an identifier name (such as a variable or a procedure) that is defined in two or more modules, ATEasy
searches and uses the first identifier name found. To override this behavior and to direct the compiler to use the identifier
from the module or library you want, you can use the Scope Resolution Operator ('.').
When referring to identifiers from different modules they must be defined as Public and in a module that can be used from
the module you are using. For more information on public identifiers, see Public Attribute.
The Scope Resolution Operator is different from the Member Operator. The first is used to direct the compiler to use an
identifier in a different scope; the second is used to access members of an object or a structure or enum. See also
Member Operator.
Example
print Driver1.nVariable
System.OnInit()
print enumATestStatus.Fail
print Internal.enumATestStatus.Fail
print Excel.enumATestStatus.Fail

Member Operator ('.')
The Member Operator is used to access members of an object or a structure.
Syntax
[StructureVariable | ObjectVariable.]MemberName
Where

Syntax Component Description
ObjectVariable Is a variable of data type Object, Variant, ControlClass, Class, or a Module
name. Module name is a Program or System or Driver name. ControlClass
or Class is defined in a COM Library Classes or Controls submodule.
MemberName Can be a Property or a Method or a Structure Field.
Scope
65
Comments
If the object is of type Variant, it must have a VarType of vtUnknown or vtObject.
For Object or Variant, no checking is performed on the compile type to verify that the members exist. The result of the
expression is always considered to be of Variant.
Unlike the Scope Resolution operator, members from any module can be used from any module. For example, a Driver
can use the Program.Name.
Example
print stdnt.sName
See Also
Public Attribute, Scope Resolution Operator, VarType Procedure
Public Attribute
A public attribute allows an Identifier to be used from other modules.
Comments
The Public attribute can be applied on most identifiers: Variables, Types, Libraries, Forms, Procedures, and more. Making
an identifier public, that is an identifier that contains a public attribute, allows other modules to use the identifier.
To reduce dependencies between modules, ATEasy allows public identifiers to be used as follows:
A program can use public symbols defined in the System or System Drivers.
A System can use public symbols defined in System Drivers.
A Driver can use public symbols defined in System drivers (although this is not
recommended).
When the ATEasy compiler searches for an identifier, ATEasy first searches for it in the module where it is being used,
then ATEasy searches in modules to the right as shown here:
1. Program->2. System->3. System Drivers (Driver N, Driver N-1, ...,
Driver1)
Note that all Identifiers defined in the module where the identifier is used are searched first.
For example, if an identifier is used in a System, ATEasy first looks in the System for all identifiers. Then ATEasy looks in
the System Drivers, starting from the last to the first, for all public identifiers.
Public attributes can be changed from the Properties Window of the identifier.
See also
Driver and System Public Members
Public Members
Ordinarily, the scope rules for a module govern what can be seen outside of the System, Program, or Driver.
The exception to these scope rules is when a submodule, procedure, variable, or event is marked as being Public. In this
case, the submodule, procedure, variable or event is visible throughout ATEasy's namespace.
For example, a System can use any Public Driver; Drivers can use Public Systems and Drivers. You can use any
submodule marked as Public from anywhere else. By contrast, non-public symbols can only be used within the same
module.


67
Statements
#ifdef Statement
Delimit statements to be conditionally parsed/compiled.
Syntax
#ifdef [ symbol ]
[ statements1 ]
[ #else
[ statements2 ] ]
#endif
Comments
The statements allows the user to conditional build an application so that only the code relevant to the desired options is
parsed. This can significantly reduce the size of the application as run and avoids problems such as unwanted code which
uses a driver which will not available in the intended run environment.
If symbol is defined, the first block of statements will be parsed. If not, the first block of statements is skipped and the
second block of statements is parsed. Either block of statements may be empty. If the second block of statements is
empty, the #else statement can be omitted.
To define a symbol, enter the symbol name in the Project Misc property page. If multiple symbols are required, separate
them by commas.
In ATEasy 5.0, a pre-defined symbol ATEASY5 is available for ATEasy 5.0 and above code.
Example
#ifdef MetricUnits
! initialize scale factors for metric units
#else
! initialize scale factors for English units
#endif

#ifdef ATEASY5
cbCount.Anchor=actrlAnchorTop or actrlAnchorLeft or
actrlAnchorRight
btnChangeCount.Anchor=actrlAnchorTop or actrlAnchorLeft or
actrlAnchorRight
#else
cbCount.Move(x2, cbCount.Top, iAddButtonWidth, cbCount.Height)
ATEasy Programming Language
68
btnChangeCount.Move(x2+(iGap/2),btnChangeCount.Top,iAddButtonWidth-
iGap,btnChangeCount.Height)
#endif
See Also
If , Predefined Symbols (V5)
Abort Statement
Stops program execution.
Syntax
Abort [ All | Uut lUutIndex]
Comments
This statement may be used to abort program execution when a critical failure occurs which makes it meaningless to
continue with the testing . The Abort statement will cause any OnAbort events to be executed to allow the shutdown to
occur in as orderly a manner as possible.
In ATEasy v8 the All and Uut optional clauses were added to support multiple UUT execution. The All is used to mark all
UUTs as pending abort. If you need to abort specific UUT use the optional UUT keyword followed by the index of the UUT
(0 based number, similar to App.UutIndex) you want to abort. When ATEasy switches to the UUT marked for abort the
UUT OnAbort sequence will start and after it's complete the UUT will not be switched to anymore until the rest of the
UUTs are complete.
Example
If dCurrent > dShortCircuit then
Abort
Endif
See Also
OnAbort Event, Abort Events, About Module Events, App.UutIndex
AddHandler Statement
Version 5
After creating an object, the user can add a handler for an object event procedure, so that when the event occurs, the
procedure can be evoked. This connects COM and .NET objects' events to a user-defined event handler.
Syntax
AddHandler ob, sEvent, procEventUser
AddHandler procEvent, procEventUser
Comments
This statement is new in ATEasy 5.0.
There are two different syntax AddHandler statements, one with early bound and the other with late bound. And there
are also two different syntax RemoveHandler statements. Depending on which AddHandler is used, its corresponding
RemoveHandler must be used, see examples below.
The procedure 'procEventUser' is will be called when the event occurs.
There must be a call to RemoveHandler that removes the handler added with AddHandler.
Statements
69
For the example with DotNet class Object, see below as well as an Example ATEasy provides, DotNet.prj.
Example
! create excel app object
ob=CreateObject("Excel.Application")
#ifdef ATEASY5
! example for using AddHandler event name
AddHandler ob, "OnNewWorkbook", OnNewWorkbookLateBind
#endif
.
.
.
#ifdef ATEASY5
! example for using AddHandler event
RemoveHandler ob, "OnNewWorkbook"
#endif
! create excel application
xlapp=CreateObject("Excel.Application")
#ifdef ATEASY5
! example for using AddHandler event
AddHandler xlapp.OnNewWorkbook, OnNewWorkbookEarlyBind
#endif
.
.
.
#ifdef ATEASY5
! example for using AddHandler event
RemoveHandler xlapp.OnNewWorkbook
#endif
The following statement inserts a button control into a APanel control, pnl on the location (left, top)=(0, 10) and width
being 10 and height being (panel heigtht - 10) on a form:

ATEasy Programming Language
70
btn=frm.InsertControl(GetKeyFromCmd(iCmd), "AButton", 0, 10, 10,
pnl.Height-10, pnl.Name)
btn.Font.Size=frm.Font.Size
btn.Caption=GetCommandMember(iCmd, ateCmdFormCaption)
btn.Visible=GetCommandStatus(iCmd, ateCmdStatusVisible,
ateCmdShowForm)
btn.Enabled=GetCommandStatus(iCmd, ateCmdStatusEnable)
btn.Tag=iCmd
btn.Picture=m_frmMain.imglMiscLarge.Images(GetCommandMember(iCmd,
ateCmdId)).ExtracIcon()
AddHandler btn, "OnClick", OnControlButtonClick
The following example shows the procedure AddHandler attached. The procedure must have the first parameter Val of
the control:

Procedure OnControlButtonClick(ctl): Void
----------------------------------------------------------------------
----------
ctl: Val AControl
iCmd: enumCommandId
{
! retrieve command index
iCmd=ctl.Tag

! execute command's procedure
....
}

The following statement create an menu separator and an menu item:

! create separator
mnu=mnuParent.InsertMenu("sSeparator1", "", amenuTypeSeparator)

! create menu item
Statements
71
mnu=mnuParent.InsertMenu(sMenuName, sMenuCaption, amenuTypeItem)

! set menu properties...
mnu.Checked=GetCommandStatus(stMenu.enCmd, ateCmdStatusChecked)
mnu.Prompt=GetCommandMember(stMenu.enCmd, ateCmdDescription)
mnu.Picture=m_frmMain.imglSmall.Images(s).ExtracIcon()

! add handler for OnClick()
AddHandler mnu.OnClick, OnMenuClick

The following example shows the procedure AddHandler attached. The procedure must have the first parameter Val of
the control:

Procedure OnMenuClick(mnu): Void
----------------------------------------------------------------------
----------
mnu: Val AMenu
stMenu: structMenu
{
! create menu popup
stMenu=mnu.Tag
....
}
The following example is for .Net class object, cls1 is of type DotNetClass1:

! fire class1 event
AddHandler cls1.OnEvent, OnEvent
cls1.FireEvent()
if objEventArgs=Nothing
TestStatus=FAIL
elseif objEventArgs.iClassNumber<>1 AND
objEventArgs.sEventDescription<>"Class1 event"
TestStatus=FAIL
ATEasy Programming Language
72
endif
The following shows the procedure OnEvent():

Procedure OnEvent(objSender, objEventArgs): Void
----------------------------------------------------------------------
----------
objSender: Val Object
objEventArgs: Val CustomEventArgs
{
Program.objEventArgs=objEventArgs
}
See Also
RemoveHandler, InsertControl(AForm), InsertMenu(AMenu)

Assignment Statement
Assigns a value to a variable.
Syntax
lvalue = expression
Comments
The lvalue expression on the left hand side of the assignment statement must be a property or a variables. A variable can
be a non-array variable (x), an element of an array (ax[i,j,k]), a structure field (struct1.field7), or an object property
(Form.Caption). The term l-value is often used as shorthand for all of the above possibilities, that is, something which can
be on the left side of an assignment statement. The left hand side must not have the Const property or be a read-only
property of an object.
A variable of any simple data type can be assigned to another variable of the same data-type. Two structure variables are
assignment compatible if they have the same structure type. Two arrays are assignment compatible it they have the same
data type, the same number of dimensions, and the same size for each dimension.
If the data type of the right hand side differs from that of the left hand side, it must be possible to convert the right hand
side to the type of the left. See the Data Conversion topic for a description of data types that can be converted. For
example, any numeric data type can be converted to any other numeric data type, and each of the two string types can be
converted to the other.
In ATEasy 5, ATEasy allows character data conversion; that is, a byte or char array can assign to String or vise versa.
In ATEasy 5, ATEasy allows a Procedure variable to be assign to String or Variant (string type) and vice versa. Also
ATEasy allows comparison between procedure and string. See below for examples.
Also ATEasy allows a variable of type Currency or DateTime to be set to a string and vice versa. Thus, you can set the
initial value of variables of Currency or DateTime type from a string ("$30,000" or "9/21/2007 9:11 AM") and also set to the
variable to a string. See below for examples.
Statements
73
Example
i = 1
s = s+"ABCD"
as[i] = Form.Caption ! assign BString to String
af[i, j] = fX*PI+1
dHeight = 5 ! assign long to double
! the following assignment statements will result in a parse error
s = 9 ! can't convert a long to a string
2 = 3 ! can't assign to a literal constant
sin(x) = 0 ! can't assign to a function value

! character data conversion - say aCharArray is an array of characters of size 10 (ATEasy 5)
sString="test string"
aCharArray=sString!aCharArray contains "test strin"-10 characters
copied

! assign String to Proc, a variable of type Procedure, type and vice versa (ATEasy 5)
! (1) string to proc
if iProc=0
procDisplay="DisplayCustomTestType1"
else
procDisplay="DisplayCustomTestType2"
endif
procDisplay(TestResult)
!(2) array of Procedures, aprocDisplay[]
for i=0 to iSize do
s="DisplayCustomTestType"+Str(i+1)
aprocDisplay[i]=s
next
! (3) proc to string/variant string type and their comparison
proc="Language.Average"! proc is a variable of type "Procedure"
ATEasy Programming Language
74
sProc=proc ! assign proc to a string
print sProc ! this prints "Language.Average"
if proc=sProc ! compare proc to string
print "True" ! this will print
else
print "False"
endif
vr=sProc ! this makes variant of string type
print vr ! this prints "Language.Average"
if proc=vr ! this comparison results True
print "True"
else
print "False"
endif

!(4) Currency to String type and vice versa
curTotalSales="$300,000.00"
sTotalSales=curTotalSalea

!(5) DateTime to String type and vice versa
dtmToday="9/21/2007 9:50:00 AM"
sCurrentDate=dtmToday
See Also
Data Conversion, Expressions, MemoryCopy
Append Statement
Version 6

This statement allows to append a message to the log string that ATEasy generates. For example, Append statement
from a test will print its message after test results instead of ahead of them.
Syntax
Append "append_message"
Statements
75
Comments
This statement is new in ATEasy 6.0.
Most test engineers expect to see in a log test results and if there are messages relating to them they usually appear after
the test results. This way the log may show a failure and then a message with more details, see examples below.
Example
! ... in the test code
Dmm Measure (TestResult)
if (TestResult<Test.min)
Append "Result too low - check circuit X"
elseif (TestResult>Test.max)
Append "Result too high - check circuit Y"
endif

!A different example :
Pio Get Port Data DWord (aPort 0, dwData)

if ((dwData and 0x40) = 0x40)
Append "Bit 7 was set, indicating timeout"
endif
if ((dwData and 0x10) = 0x100)
Append "Bit 9 was set, indicating over voltage"
endif
See Also
Print, Trace


Command Statement
Provides a user-defined statement.
Syntax
[ Result = ] ModuleName CommandItem ... [ ( Arguments ) ]
Comments
The command statement is defined in ModuleName. This can be one of the following:
ATEasy Programming Language
76

Module Description
System The current system module.
Driver Specifies that the commands are to be found in the current driver, that is.
the driver which contains the Command statement.
Program Specifies that the commands are to be found in the current program, that
is. the program which contains the Command statement.
DriverName The name of the driver module item which contains the commands, for
example, DMM.
The CommandItems are one or more identifiers separated by blanks. The first CommandItemmust be a top level
command in the specified system, driver, or program module. Each subsequent CommandItem must be a subcommand
of the preceding CommandItem. The final CommandItem must have been assigned a procedure or I/O Table to be
executed to perform the command. As opposed to regular identifiers, CommandItem identifiers can start with a number,
so that common instrument settings such 12V or 100k can be used as CommandItems.
The Arguments are zero or more expressions separated with commas passed to the subroutine or to the I/O Table. Each
parameter to the subroutine or I/O Table which is not optional and which was not given a fixed value as part of the
command definition must have a corresponding Argument expression supplied. If no arguments are supplied, the
parentheses may be omitted.
If the command returns a value, the return value can be used in an assignment statement or in any other expression in
the same manner as any function call.
Example
In the following statement, DMM is the ModuleName, and Set, Function, and VDC are the CommandItems.
DMM Set Function VDC
In the following statement, DMM2 is the ModuleName, and Measure is the CommandItem.
DMM2 Measure (dResult)
See Also
Procedures, Statements, Variable Naming Conventions
Comment Statement
Allows explanatory remarks to be entered into programs.

In ATEasy 5.0, block or multi-line comment (similar to C programming language) is also allowed.
Syntax
!
/* .... */ - block comments
Comments
The text followed by '!' is a comment (until the end of the line) that ignored by the ATEasy compiler during program
execution.
Line comments may be entered at the beginning of a line or at the end of a statement.
Statements
77
The block Comments, the text inclosed by '/*' and '*/' is a comment that ignored by the ATEasy compiler. When this
comments are used in the middle of statements, for example arithmetic statement, it cannot continue to the next line by
keeping the general rule of ATEasy language: One statement on One line. To continue onto more than one line, the
continuous operator, '\', is allowed in ATEasy 5.0.
Example
! This Test verifies the voltage output of the UUT
!~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Measure DMM VDC at_J1_1 ! Measure output

/* The followings/ and this are block comments:
In ATEasy language, one statement cannot be written in more than
two lines.
However, the continuous operator, '\' is available for multi-lines
statement.
The second example below is not correct because the statement went
on in three lines without the continuous operator.
*/
s = "abc /* comment */ \
+ "def" ! s="abcdef", ATEasy 5.0 only
See Also
Ignore, Continue
Continue Statement
Passes control to the next iteration of the smallest enclosing For, Loop, Repeat, or While statement in which it appears.
Syntax
Continue
Comments
Program statements between the Continue statement and the EndLoop, Next, EndWhile, and Until are skipped.
Example
for i=0 to 3 do
print i,
if i > 1 then
continue
endif
print i,
ATEasy Programming Language
78
next
! The output is: 0 0 1 1 2 3
See Also
ExitLoop, For, Loop, Repeat, While
Error Statement
Signal or rethrow an error condition.
Syntax
Error [integer-exp [, string-exp] ]
Comments
This statement allows user code to signal an error condition. The optional integer-exp is the error number, which can be
the same as an ATEasy error number or it can be a user-defined application specific error number must be different than
zero. The optional string-exp is the error message. Error-handling code (Catch block or OnError event) can retrieve the
error number and message by calling the internal library routines GetErrorNum and GetErrorMsg.
An Error statement with no parameters re-throws the current error condition. This form of the Error statement is only valid
in error handling code. It is used when the current error-handling code decides that it cannot handle the error condition
and wants to pass it on to the next appropriate block of error-handling code, that is, an outer Try block with a matching
Catch statement or the next OnError event.
Example
If nStatus<0 Then
Error 1234, "Invalid number of dimensions"
Endif
See Also
Try, OnError Event, Error Events
Exit Statement
Terminates the current application.
Syntax
Exit [EndEvents]
Comments
The current application is terminated immediately without calling any OnEndXXX event procedures if you call this without
EndEvents. When you enter the optional EndEvents, then all OnEndXXX events will be called and executed.
The following table shows ATEasy handling end events upon exit statement under different versions and builds:

ATEasy Version
Build
OnEndXXX Events Handling
3.0 all End events are not called at all.
Statements
79
4.0
92
End events are called without the optional EndEvents.
5.0 102 End events are called without the optional EndEvents.
4.0 94 & above End events are called with the optional EndEvents.
5.0 104 & above End events are called with the optional EndEvents.
Examples
If iSelection = enQuit Then Exit

! make sure that we have no empty program or driver

for lIndex=0 to App.ProgramsCount-1
ob=App.Programs(lIndex)
if ob=Nothing
MsgBox("One of programs' shortcut is empty - exiting")
Exit EndEvents
endif
next
See Also
Run, Test, Task, Abort Statement
Exitloop Statement
Terminates the smallest enclosing For, Loop, Repeat, or While statement in which it appears.
Syntax
Exitloop
Example
i=0
Loop
! Program statements
if i > 5 then
exitloop
endif
print i,
i=i+1
ATEasy Programming Language
80
Endloop
! this will print 0 1 2 3 4 5
See Also
For, Loop, Repeat, While
ExitProgram Statement (ATEasy v5.0 )
Exit the current Program.
Syntax
ExitProgram
Comments
The statement is used to exit the current Program. The statement can be only be called while a program in running. If the
statement is used wile executing a Test OnEndTest, than OnEndTask and than OnEnd (program) and OnEndProgram
(for system and drivers) will be called before the program exit. If called while running OnEndTest than OnEndTask and
OnEnd/OnEndProgram will be called. If called while running OnEndTask than only the OnEnd/OnEndProgram will be
called. ExitProgram statement could be used in a procedure called from a program to end the current program.
This statement behaves exactly same as Task EndEvents -1.
A run-time error is generated if no program is currently running, for example, performing Debug Doit on statements in a
test when no program was running.
Example
If TestStatus=Fail
ExitProgram
endif
See Also
ExitTask Statement, ExitTest Statement, OnEnd, OnEndProgram, OnTaskEnd, OnTestEnd, Task Statement, Test
Statement, Run Statement, Program Variable
ExitTask Statement
Exit the current Task.
Syntax
ExitTask
Comments
The statement is used to exit the current Task. Any OnTaskEnd event procedures will be called for the current task and
the OnTestEnd events will also be called for the current test if one is running. ExitTask statement could be used in a
procedure called from a task to end the current task.
A run-time error is generated if no task is currently running, for example, performing Debug Doit on statements in a test
when no program was running.
Example
If iRunMode<>RUN_ALL_TESTS
Statements
81
ExitTask ! skip all tests in this task
Endif
See Also
Goto, Task, Test
ExitTest Statement
Exit the current Test.
Syntax
ExitTest
Comments
The statement is used to exit the current Test. All the usual end of test processing takes place, for example, the
TestStatus is set according to the TestResult and any OnTestEnd event procedures will be called for the current test.
ExitTest statement could be used in a procedure called from a test to end the current test.
A run-time error is generated if no test is currently running, for example, performing Debug Doit on statements in a test
when no program was running.
Example
Procedure CheckStatus (): Bool
{
If iDeviceStatus = PASS Then
Return True
ElseIf iDeviceStatus >= ERR Then
ExitTest ! skip the rest of this test
Endif
Return False
}
See Also
Goto, Task, Test
For Statement
Repeats a block of statements a specified number of times.
Syntax
For IndexVariable = StartValue { To | Downto } FinalValue [ Do ]
[ statements ]
Next
ATEasy Programming Language
82
Comments
IndexVariable is an integer variable (not array). StartValue and FinalValue are numeric expressions.
The Do keyword is optional. To or Downto is required.
The IndexVariable starts at the StartValue and is incremented or decremented by 1 for each loop until the IndexVariable is
greater than (or less than when using Downto) the FinalValue.
Example
For i=1 To 5 Do
Print i;
Next
! This will print 1 2 3 4 5
! i is now 6
For i=5 Downto 1
print i;
Next
! This will print 5 4 3 2 1
! i is now 0
For i=0 To -1
print i
Next
! This will not print
! i is 0
See Also
Continue, Exitloop, Expressions, Loop, Repeat, While
Function Call Statement
Executes statements defined in the function procedure and returns a value.
Syntax
[ x = ] FuncName ( [ Arguments ] )
Parameters
Zero or more Arguments separated by commas.
Returns
A function procedure can return any simple type, but cannot return an array or structure.
Statements
83
Comments
A function is a procedure which returns a value. A function call can be used as a stand alone statement, for example:
FUNCT1(argument_list)
or as a value in an expression.
x = FUNCT1(argument_list) + y
Even though a procedure returns a value, you do not have to use it.
If the procedure has any type other than VOID, for example, Long, then it must return a value of that type.
For a detailed description of how the arguments are passed to the procedure parameters, how optional parameters are
handled, etc., see Subroutine Call.
After the parameters are initialized, control is transferred to the first statement of the procedure. The statements of the
procedure are executed until a Return statement is encountered. The Return statement must have an expression. The
value of the return expression is converted to the type of the function if necessary, control returns to the calling code, and
the returned value is used in any subsequent calculations required to evaluate the expression which contained the
function call. If the return value is not of interest for a particular call, the function can be called as if it were a subroutine
procedure.
Example
In the following example, the Mid internal function arguments are first evaluated. Then the Mid function is called. Finally,
the Val is called and passed to the Print statement.
Print Val(Mid(s, i, i+10), 10)
See Also
Expressions, Subroutine Call
Goto Statement
Performs an unconditional branch to the statement following the specified label.
Syntax
Goto Label
.
.
Label:
Comments
The specified label must be declared inside the current code segment (Test or Subroutine) before or after the Goto
statement.
Example
If i = 5 Then
Goto TestEnd
Endif
! Program statements
ATEasy Programming Language
84
TestEnd:
! other Program statements
See Also
Task, Test
If Statement
Makes a decision regarding the program's flow based on a result returned by an expression.
Syntax
If bool-exp1 [ Then ]
[ statements1 ]
[ Elseif bool-exp2 [ Then ]
[ statements2 ]... ]
[ Else
[ statements3 ] ]
Endif
Comments
If the result of the bool-exp1 is True, the statements1 are executed. If bool-exp1 is False, the next Elseif (if any)
expression is evaluated. If the next Elseif expression is True, the corresponding statements are executed. If none of the
expressions is true, any statements following the Else are executed. After the first statements are executed, control
passes to the next statement following the Endif.
Example
If i > 5 Then
i=i+1
Endif
! if i was 3, now it is still 3
! if i was 6, now it is 7
! --------------------------------
If (i > 2 and i < 6) Then
i=i+1
Endif
! if i was 3, now it is 4
! if i was 6, now it is still 6
! --------------------------------
Statements
85
If i
i=i+1
Endif
! if i was 0, now it is still 0
! if i was 6, now it is 7
! --------------------------------
If i < 2 then
j=1
elseif (i = 2) then
j=2
elseif i=3
j=3
else
j=4
Endif
! if i is 1, j is 1
! if i is 2, j is 2
! if i is 3, j is 3
! if i is 6, j is 4
! --------------------------------
! nested if Example
If i < 2
if i =1
j=1
else
j=2
endif
elseif i=2
j=3
else
ATEasy Programming Language
86
j=4
endif
! if i is 1, j is 1
! if i is 0, j is 2
! if i is 2, j is 3
! if i is 6, j is 4
See Also
#ifdef, Expressions
Ignore Statement
Ignores a non-fatal run-time (recoverable) error and resumes execution of the next statement.
Syntax
Ignore
Comments
This statement can be used only in error-handling code (Catch blocks and OnError events). Execution of this statement
outside of error-handling code or if the error being handled is not recoverable, results in a run-time error. A valid Ignore
statement causes execution to resume at the start of the next statement after the one which caused the error. If the error
occurred inside a Try block, execution resumes immediately after the EndTry statement in the Try-Catch-EndTry
compound statement with the Catch statement which caught the error.
Example
Sub _ErrorProgram
{
TestStatus=ERR ! set teststatus to error
! display the error
Print "Error "GetErrorNum();" ";GetErrorString()
! resume execution to the next statement
Ignore
}
See Also
Error Statement, Comment, Retry
Load Statement
Loads a form.
Syntax
Load frmVar [, [bModal] [,Parent ]]
Statements
87
Comments
The Load statement creates a form object and a form window. The type of the form variable frmVar determines which
form will be loaded. The type is the name of the form that appears below the Forms submodule. If frmVar has a value of
Nothing, then a new form object is created and the form object is stored in frmVar. The form is then initialized and the
form window and its controls and menus are created. Unless the Visible property for the form is turned off at design time,
the form is made visible.
If the optional Bool argument bModal is true (the default value), the form is loaded as a modal form. When a form is
modal, the Load statement will not return and the next line of code after the Load statement will not be executed until the
form is unloaded and its window is destroyed. However, form events can be called and executed during that time.
If the bModal argument is false, the form is loaded as a modeless form and the Load statement returns immediately after
the form is loaded. When an event is received, the current code is interrupted and the form event procedure is called.
Once the form event procedure is returned, the execution resumes. Loading a form in modal mode will always disable all
windows that are created before, forcing users to close the window before working on other windows.
The optional Parent argument is a window handle or a form object that will be used as a parent or owner window for the
new form window created on top of its parent/owner window. Omitting this argument indicates to use the Form internal
variable as a parent. If the Load is not called from within a form ATEasy will use the current active top-level window as a
parent that was created from within this thread. Specifying 0 as an argument indicates that the desktop window is used as
a parent.
The created form is always displayed on top of its parent form. In addition, if the form is created as a modal form, its
parent window will be disabled and will not receive any user input until the form is unloaded. If the parent form is closed
than the current form is also unload automatically.
After the Load statement is called, the form object is created and the OnInitialize event procedure is called. Then the form
window is created and the OnLoad event procedure is called. The form is visible if the Visible property is set to True and
only after the OnLoad procedure is returned.
If the frmVar has a value that is different than Nothing the form will be reload. Reloading a form will create the form
window only if it is not already created, the form variables and members will not reinitialized if they are already created. If
you need to initialize the form members and the form you create is modeless you can load the form in modeless mode,
than initialize its members and then load it again in modeless mode (see example below).
Please refer Loading and Unloading Events for forms' events and their order when a form is created and closed.
In addition to examples below, more examples for forms are in the forms.prj example in ATEasy Examples directory.
Examples
The following example creates a modal form called Profile Editor (m_frmProfileEditor) on top of the current form:

Load m_frmProfileEditor
! we get here after the form window is closed since this is a modal
form
If m_frmProfileEditor.f_bCanceled ! check member
! do something
EndIf
m_frmProfileEditor=Nothing ! done with the form - release its
memory
The following example shows : create a modeless form, frm (a local variable) and stay in the loop until frm.f_bWait being
set to False:

Load frm, False, 0 ! create modeless on the desktop
ATEasy Programming Language
88
! initialize mebers
frm.f_iCount=m_iCount
frm.Initialize() ! call a form procedure initialize
frm.Visible=True ! make it visible
frm.Refresh()
while frm.hWnd and frm.f_bWait
DoEvents()
WaitForEvent() ! don't consume 100% cpu
Endwhile
m_iCount=frm.iCount
frm=Nothing
The following example shows how to create a modal form and set its variables and properties :

load frmModal, false ! create modless so we can set form members
frmModal.Tag="hello" ! set tag
frmModal.lVariable=120 ! set member variable
load frmModal, true ! now make it modal
! place code after the form window is close
Print frmModal.lVariable
frmModal=Nothing
The following example creates two forms the second one will behave similar to modal but will disable only its parent and
not all the currently displayed forms :

load frmParent1, False ! create first form
frmParent1.Enabled=False
load frmParent2, False, 0 ! create 2nd form with desktop parent
frmParent2.Caption="hello"
! wait until form 1 is closed
while frmParent2.hWnd
DoEvents()
WaitForEvent() !do not consume 100% cpu
endwhile

Statements
89
! form 2 was closed now enable form 1 and activate
frmParent1.Enabled=True
frmParent1.Visible=True
! wait until from 1 is closed
while frmParent1.hWnd
DoEvents()
WaitForEvent() !do not consume 100% cpu
endwhile
See Also
AForm, OnInitialize, OnLoad, OnQueryUnload, OnTerminate, OnUnload, Unload, DoEvents, WaitForEvents, Loading and
Unloading Events
Loop Statement
Executes several statements in an endless loop.
Syntax
Loop
[ statements ]
Endloop
Comments
The statements are executed repeatedly until the control is transferred outside the Loop statement. Usually the Exitloop
is used to terminate the loop and to transfer control to the next statement.
Example
i=0
Loop
i+i+1
If i =3 Then
i =4
continue
Elseif i=6
Exitloop
Endif
Print i;
Endloop
ATEasy Programming Language
90
! This will print 1 2 5
See Also
Continue, Exitloop, For, Repeat, While
LoadLibrary Statement
Version 7
Loads a DLL library.
Syntax
LoadLibrary DllLibrary, sDLLFilePath
Comments
The LoadLibrary statement loads a DLL library. The first argument of the LoadLibrary is a DLL name symbol that
previously inserted under submodule Libraries. The DLL name must be marked as public if the Load statement is called
from external module. DLL can be any DLL including ATEasy DLL.
The LoadLibrary statement will first unload the DLL if loaded already and load one in the sDLLFilePath argument.
Unloading or Loading a DLL allows the application to switch the modules DLLs implementation with another DLL. This can
be useful when creating generic driver of which implementation can be changed by replacing a DLL. The DLL should have
similar exported functions and parameters (count, type and return value), while the implementation of the exported
functions can be different.
ATEasy does not perform any check to verify that the newly loaded DLL has the same export function names, which is
done when the DLL procedure is actually called. In addition ATEasy cannot perform a check to see if the DLL procedure
being called has the same parameters count and type. Calling a DLL procedure with different number of arguments (as
defined in ATEasy under libraries submodule) may result in run-time error or memory corruption. Special care must be
taken when defining the ATEasy DLL procedure and parameters types to make sure it matches the actual DLL exported
function.
The second argument sDLLFilePath can be relative or absolute path. If you enter a filename with no pathname (directory),
then ATEasy uses the following searching rules in order (same ones used during Inserting DLL) :
The Windows directory.

The Windows system directory (the directory containing such system files as GDI.EXE).

The directories listed in the PATH environment variable.
If the DLL is failed to load because the file path is not valid or the file is not found or any other reason, a run-time error will
be generated.
If LoadOnAccess DLL property is on (checked in the DLL property page), the DLL will be loaded when a DLL procedure is
called .
When the LoadLibrary is called, the DLL reference count is incremented. For non-ATEasy DLL the DLL LibMain is called
to notify that it is loaded. For ATEasy DLL OnInit (OnInit/OnInitSystem) events are called after the DLL is loaded and
before a DLL procedure is called.
Example
The following example loads the gxsw32 library from a file gxsw32.dll, and the file is searched according to the DLL
searching rules:

LoadLibrary gxsw32, "gxsw32.dll"
Statements
91
The following example loads gxsw32 DLL of the specific location for the module MUX:

LoadLibrary MUX.gxsw, "c:\\gxsw32.dll"

See Also
UnloadLibrary

Pause Statement
Suspends program execution until resumed by the user.
Syntax
Pause
Comments
This statement suspends program execution indefinitely. The user must select Continue from the ATEasy Control Dialog
(or other commands from the Run menu) in order to resume execution.
Example
If i = 1 Then
Print "Something is wrong !!!"
Pause
Endif
See Also
Abort, EnableAbortPause, Error Statement
Print Statement
Appends expressions converted to strings to the Log window.
Syntax
Print [ Using sFormatSpec ; ][ [ Expression ] [ , ] [ ; ]... ]
Comments
The Print statement is used to print text to the Log window.
If the Print statement is not ended with a comma (,) or a semicolon (;) the print position is moved to the beginning of a
new line after ATEasy outputs the string. A new line can also be generated by embedding the characters "\r\n" or "\n"
inside a string Expression.
If the Log window is in HTML mode (PlainText=False) a new line "\r\n" will not generate a new paragraph. You must use
the "<br>" tag to create a new line.
A comma can be used to move the print position to the beginning of the next Tab, which is the next position that can
divided by 15.
ATEasy Programming Language
92
A semicolon can be used as a separator between Expressions without moving the print position.
The Expression can be a string-exp or a simple (not array) numeric-exp. Each numeric-exp is converted to a string that
contains a leading space if the number is positive and the minus (-) if the number is negative. The format of a converted
numeric-exp to string is the same as the Str function (with iBase as 10).
The optional Using clause is used to format numeric values. The sFormatSpec is a string-exp that has the same syntax
as the sFormatSpec used by the Format function. After the semicolon (;) in the Using clause, only numeric-exps are
allowed as Expressions.
Example
Print "ATEasy";
Print " is"; " Easy"
Print 4*5,
Print "AT"; "Easy"
!This will print:
!ATEasy is Easy
!20 ATEasy
Print using "###.###"; 1.45
Print using "###.###"; -1.45
Print using "###.###"; -99.4523
Print using "###.###"; 2344.9549
Print using "###.###E###"; 2344.9549
!This will print:`
! 1.450
! -1.450
!-99.452
! 2344.955
! 23.450E+02
See Also
Chr, Format, PlainText, Str, Trace, Append
ReDim Statement
Reallocates storage space for arrays.
Syntax
ReDim [Preserve] varname [size1 [, ...] ]
Statements
93
Comments
The ReDim statement is used to size or resize an array variable varname. You can use the ReDim statement repeatedly
to change the number of elements. The statement cannot be used to change the number of dimensions of the array.
If the Preserve is not used the array is initialized and its values are reset to their default initial value (zero for numeric
types, empty string for string, etc.). The variable initial value as set from the variable Value property page is not used.
If you use the Preserve keyword, the data stored in the array is preserved. New elements added will have the data type
default initial value. while existing elements will keep their values.
The ReDim statement is useful for reducing the amount of memory that the application consumes. Once the array is no
longer used you can use the ReDim to decrease it's size.
Example
The following example uses ReDim to allocate array as required by a Scope instruments to calculate the mean value.
After the calculation is complete the array size is reduced to a minimum.
! read data to array and calc mean value
Scope Read Data Size (dwSize)
ReDim adwReadings [dwSize]
Scope Read Data (adwReadings, dwSize)
TestResult=Mean (adwReadings)
! reduce the array size to 1 since we no longer need it
ReDim adwReadings[1]
See Also
Arrays
RemoveHandler Statement
Version 5
Removes the handler that created for an object event procedure via AddHandler.
Syntax
RemoveHandler ob, sEvent
RemoveHandler procEvent
Comments
This statement must be coupled with AddHandler.
Example

#ifdef ATEASY5
! example for using event name
RemoveHandler ob, "OnNewWorkbook"
#endif
ATEasy Programming Language
94
#ifdef ATEASY5
! example for using event proc
RemoveHandler OnNewWorkbook
#endif
See Also
AddHandler
Repeat Statement
Executes Statements repeatedly until a specified bool-exp is true.
Syntax
Repeat
Statements
Until bool-exp
Comments
After Statements are executed, the bool-exp is evaluated. If the result is False, control is transferred to the statement
following the Repeat... Until statement. Otherwise, the Repeat... Until statement is executed again.
Example
i=0
Repeat
i=i+1
Print i;
Until i > 4
! i is now 5
! This will print 1 2 3 4 5
See Also
Continue, Exitloop, Expressions, For, Loop, While
Reset Statement
Resets the running program.
Syntax
Reset [ All | Uut lUutIndex]
Comments
This statement calls the OnReset event of the application modules. After the events were called the next statement
following the reset statement is executed.
Statements
95
The sequence of OnReset event called is as follows:
1. Program.OnReset (if a program is currently running)
2. Driver(i).OnReset
3. System.OnReset
In ATEasy v8 the All and Uut optional clauses were added to support multiple UUT execution. The All keyword is used to
mark all UUTs as pending reset. If you need to reset specific UUT use the optional UUT keyword followed by the index of
the UUT (0 based number, similar to App.UutIndex) of the UUT you want to reset. When ATEasy switches to the UUT
marked for reset the UUT OnReset sequence will start.
Example
The following code is the OnClick event for the mnuReset menu item in the MainForm form which allows the user to
control the application:
! MainForm.mnuReset.OnClick
print "-- Resetting application --"
Reset
See Also
Abort, OnReset, AProgram.Reset, Reset Events, About Module Events, App.UutIndex
Retry Statement
Retries a non-fatal run-time (recoverable) error and resumes execution to the statement that caused the error.
Syntax
Retry
Comments
This statement can be used only in error handling code (Catch blocks and OnError events). Execution of this statement
outside of error handling code or if the error being handled is not recoverable, results in a run-time error. A valid Retry
statement causes execution to resume at the start of the statement which caused the error. If the error occurred inside a
Try block, execution resumes immediately after the Try statement in the Try-Catch-EndTry compound statement with the
Catch statement that caught the error.
Example
The following example allows three retries in a program before it is aborted.
Procedure Program1.OnError(): Void
{
Print "Error has occurred."
Retries=iRetries+1
If iRetries < 3 Then
Print "Trying to retry..."
Retry
Else
ATEasy Programming Language
96
Print "Retry has failed. Aborting..."
Abort
Endif
}
See Also
Abort Statement, Error Statement, GetErrorMsg, GetErrorNum, Ignore, Pause, Try
Return Statement
Terminates execution of the procedure in which it appears and returns control to the calling code. If the procedure is a
function, the Return statement specifies the value to be returned as the result of calling the function.
Syntax
Return [ expression ]
Comments
For a subroutine procedure (where the Returns type of the procedure is Void), the Return statement must not have a
return value expression and a Return statement at the end of the subroutine is optional.
For a function procedure (where the Returns type of the procedure is not Void), every Return statement in the function
must have a return value expression. In addition, every possible path of execution through the function code must end in
Return statement. The expression must be assignment compatible with the Returns type of the function. The expression
value is converted to the Returns type of the function and used as the value of the function call in the calling code.
Example
Procedure CheckStatus (): Void
{
If iStatus <> PASS Then
sStatus=""
Return
Endif
sStatus=asStatus[iStatus]
}
Procedure ModuleTypeString(enType): String
----------------------------------------------------------
enType: Val Long
{
! Return string for module type
SELECT enType
Statements
97
CASE amoduleTypeDriver
RETURN "Driver"
CASE amoduleTypeProgram
RETURN "Program"
CASE amoduleTypeSystem
RETURN "System"
CASE ELSE
RETURN "*** Unknown module type ***"
ENDSELECT
}
See Also
Function Call, Subroutine Call
Run Statement
modified v8
Runs one or more ATEasy programs. Execution of the current program(s) is terminated and then the specified program is
run.
Syntax
Run [EndEvents] [ program-specifier ] [ All | Uut iUutIndex ]
Comments
The program-specifier can be a string expression or object expression. If program-specifier is a string expression, it
specifies the program shortcut name. If program-specifier is an object expression, it can be the AProgram object for any
program in the current project (see App.Programs property).The statement generates a run-time error if program-specifier
does not refer to a valid program.
When Run statement is called within the OnInitProgram/OnInit, OnInitTask, OnInitTest, or any other events and if the
EndEvents optional keyword is specified, all end events, OnEndTest, OnEndTask and OnEndProgram/OnEnd, will be
executed before starting the new program.
Without the EndEvents optional keyword, the OnEndTest, OnEndTask and OnEndProgram/OnEnd events are not
triggered for the current test and task which are being terminated.
In ATEasy v8 the All and Uut optional clauses were added to support multiple UUT execution. When these keywords are
used, you can specify the Run statement with or without the program-specifier. If no program-specifier was specified than
the current set of the App.UutProgram is used, if the program-specifier is used it will change the App.UutProgram to the
specified program. When using the Uut keyword the iUutIndex specifies the UUT index where the run is executed, this
number must be in the range of 0 to App.UutCount-1. The run statement will attempt to reuse (if created) or create a
thread if the specified UUT run mode is set to aUutRunModeParallel (AApp.UutRunMode). In Sequential run mode,
specifying the Uut clause will cause the Run statement to execute after ATEasy switches to the UUT and is not an
immediate jump.
In ATEasy v2 the program-specifier string expression was a filename, if you are migrating from ATEasy2 you must
change it to a program shortcut.
ATEasy Programming Language
98
Example
! run the 4th program ( index = 3 ) in the current project (
application )
Run App.Programs(3)
! restart the current program
Run Program
! when ATEasy switches to uut 1, it will restart the program running
on that UUT
nUnit=1
Run Uut nUnit
! when ATEasy switches to uut 1, it will restart the program running
on that UUT
nUnit=1
Run Uut nUnit
! end current programs in all uuts and run "program1" in all uuts
Run EndEvents "Program1" All
! end current program in UUT 0 and run Program1 when switched to UUT 0
Run EndEvents "Program1" Uut 0
See Also
Abort, Exit, WinExec OnInit Event, OnInitProgram Event, Program Variable, AApp.UutCount, AApp.UutProgram,
AAppUutRunMode
Select Statement
Executes one of several groups of statements, depending on the value of an expression.
Syntax
Select testexpression
[Case expressionlist1
[statements-n]]
[Case Else
[elsestatements]]
EndSelect
The Select statement syntax has the following parts:

Name Description
testexpression An integer or string expression.
expressionlist-n Required if a Case appears. The expressionlist-n must of the same type
as the testexpression and must be a constant. Expressionlist-n be one or
more of the following forms:
Statements
99
expression,
expression To expression,
The To keyword specifies a range of values. If you use the To keyword,
the smaller value must appear before To.
statements-n One or more statements executed if testexpression matches any part of
expressionlist-n.
elsestatements One or more statements executed if testexpression does not match any
of the Case clauses.
Comments
If testexpression matches any Case expressionlist expression, the statements following that Case clause are executed up
to the next Case clause, or, for the last clause, up to EndSelect. Control then passes to the statement following
EndSelect. If testexpression matches an expressionlist expression in more than one Case clause, only the statements
following the first match are executed.
The Case Else clause is used to indicate the elsestatements to be executed if no match is found between the
testexpression and an expressionlist in any of the other Case selections. Although not required, it is a good idea to have a
Case Else statement in the Select block to handle unforeseen testexpression values. If no Case expressionlist matches
testexpression and there is no Case Else statement, execution continues at the statement following EndSelect.
You can use multiple expressions or ranges in each Case clause. For example, the following line is valid:
Case 1 To 4, 7 To 9, 11, 13
You also can specify ranges and multiple expressions for character strings. In the following example, Case matches
strings that are exactly equal to "everything", then strings that fall between "nuts" and "soup" in alphabetic order:
Case "everything", "nuts" To "soup"
Select statements can be nested. Each nested Select statement must have a matching EndSelect statement.
The Select statement is an alternative to If...Then...Else for selectively executing one block of statements from among
multiple blocks of statements. A Select statement provides capability similar to the If...Then...Else statement, but it makes
code more readable when there are several choices.
A Select structure works with a single testexpression that is evaluated once, at the top of the structure. ATEasy then
compares the result of this expression with the values for each Case in the structure. If there is a match, it executes the
block of statements associated with that Case.
Each expressionlist is a list of one or more values. If there is more than one value in a single list, the values are separated
by commas. Each statementblock statements-n contains zero or more statements. If more than one Case matches
testexpression, only the statement block associated with the first matching Case will execute. If none of the values in the
expression lists matches testexpression, ATEasy executes statements in the Case Else clause (which is optional).
Notice that the Select structure evaluates an expression once at the top of the structure. In contrast, the If...Then...Else
structure can evaluate a different expression for each ElseIf statement. You can replace an If...Then...Else structure with a
Select structure only if the If statement and each ElseIf statement evaluates the same expression.
Example
This example uses the Select statement to evaluate the value of a variable. The second Case clause contains the value
of the variable being evaluated, and therefore only the statement associated with it is executed.
nSwt = 8 ! Initialize variable.
Select nSwt ! Evaluate nSwt.
Case 1 To 5 ! nSwt between 1 and 5, inclusive.
Print "Between 1 and 5"
! The following is the only Case clause
ATEasy Programming Language
100
! that evaluates to True.
Case 6, 7, 8 ! nSwt between 6 and 8.
Print "Between 6 and 8"
Case 9 To 10 ! nSwt is 9 or 10.
Print "Greater than 8"
Case Else ! Other values.
Print "Not between 1 and 10"
EndSelect
See Also
#Ifdef, Expressions, If
Subroutine Call Statement
Executes statements defined in the subroutine and returns control to the statement following the subroutine call.
Syntax
SubName ( [ Arguments ] )
Parameters
Zero or more Arguments separated by commas.
Returns
Nothing.
Comments
A subroutine is a procedure which has type Void, that is, it does not return a value.
For each procedure parameter which is not optional, there must be a corresponding argument expression. If no argument
expression is supplied for an optional parameter, the default value specified for that parameter will be passed. An optional
parameter can be explicitly omitted by just entering the comma which separates that argument from the next one. If all
remaining parameters are optional they can all be omitted by entering the closing parenthesis which ends the argument
list.
A Val parameter to a procedure is effectively a local variable of the procedure which is assigned the value of the
corresponding argument expression before the procedure statements are executed. Any change to the value of the
parameter only affects the local variable. No other variables in the calling procedure or global variables are affected. The
argument expression will be converted to the data type of the parameter as necessary. It is an error if there is no such
conversion.
A Var parameter is effectively a temporary alias to the corresponding argument. The argument expression passed to a
Var parameter must a variable, array element, or structure field, and must have the same type as the parameter. Any
change to the Var parameter is really a change to the passed argument.
After the parameters are initialized, control is transferred to the first statement of the procedure. The statements of the
procedure are executed until a Return statement is encountered or the last statement of the procedure has been
executed. At that time, control is transferred to the statement following the subroutine call.
Example
The following examples demonstrate calls to subroutine procedures:
Statements
101
SetLogOff( )
Delay(1000)
The following examples demonstrate the omission of optional parameters. Assuming Subr has one required and two
optional parameters, all of the following are valid subroutine calls:
Subr(a, b, c) ! explicitly supply values for all parameters
Subr(d) ! supply value for first parameter, use default for second and
third.
Subr(e,,) ! same as above, but makes it obvious that parameters have
been omitted
Subr(f,, g) ! supply value for first and third parameters, use default
for second.
See Also
Expressions, Function Call
Task Statement
Performs an unconditional branch (out of the normal program sequence) to the specified Task or Test.
Syntax
Task [EndEvents] task-specifier [ Uut lUutIndex ]
Comments
The Task statement is like a jump. It does not return to the statement following the Task statement after the task is
completed. ATEasy executes tasks in a sequential order by default, so if you jump to Task 3, Task 4 will be called after
that. When running from the test executive the next task after Task 3 is one in the tree view that is checked (selected for
run).
You may choose to place some code in OnEndTask that will call the next task after the current task is completed. For
example, in OnEndTask you can check the Task.Id or Task.Number or Task.Index to figure out what task was completed,
you can also check Task.Status or check some global boolean variables or some number that will tell you what is the next
task to execute. (Task.Id and Test.Id are unique in the application.)
The task-specifier can be an object or string expression, or a list of integer expressions. If task-specifier is an object
expression, it should be the Task or Test object for any Task or Test in the current program. If task-specifier is a string
expression, it should be the Id of any Task or Test in the current program.
If task-specifier is a list integer expressions separated by commas, then these numbers are directions on how to walk the
tree of Tasks and Tests to get to the desired Task or Test. For example, the statement
Task 2, 4
specifies that going to the 2nd top-level Task, then to its fourth sub-task/test, Task or Test 2.4. Note that the integer
numbers are 1-based Task/Test numbers.
If task-specifier is a single integer expression with invalid value such as -1, 0, or 99 (where no Task 99 exists), the
program will be terminated.
If task-specifier includes invalid value 0, for example
Task 5, 0
this statement will jump to first test of Task 6.
ATEasy Programming Language
102
Unless the EndEvents optional keyword is specified, the OnEndTest and OnEndTask events are not triggered for the
current test and task which are being terminated, but the OnInitTask (if starting a test in a different task) and OnInitTest
events are triggered before starting the new test. When the Task statement is called within the OnInitTest, OnInitTask, or
any other event, and if the EndEvents is specified, then the end events, OnEndTest, OnEndTask are called before
jumping to the new task or test.
The statement generates a run-time error if task-specifier does not refer to a valid Task (invalid expression, for example
9.9), if a program is not being run, or if the program is being run in a special mode (such as Loop Test or Loop Task).
The optional keywords [ Uut lUutIndex] are new from ATEasy v8. The Uut clause marks the specified UUT index (see
App.UutIndex) as pending jump to the specified Task. When ATEasy switches to the UUT, the jump to the specified Task
will be done.
Example
! go to the last top level task ( or test )
Task EndEvents Program.Tests(Program.TestsCount-1)
! go to the power supply task
Task EndEvents "PowerSupply"
! terminate the current program
Task EndEvents -1
! go to task or test specified by number list -- see comments above
for detailed explanation
Task EndEvents 2, 4
See Also
About Module Events, Initialization Events, End Events, GetProgramTasks, GetTaskNum, GetTaskTests, GetTestNum,
SetProfileNum, Test Statement, Task Variable, Test Variable, App.UutIndex
Test Statement
Performs an unconditional branch (out of the normal program sequence) to a specified Test in the current running Task or
in the current program.
Syntax
Test [EndEvents] test-specifier
Comments
The Test statement is like a jump. It does not return to the statement following the Test statement after the test is
completed. ATEasy executes tests in a sequential order by default, so if you jump to test 3, test 4 will be called after that.
When running from the test executive the next test after Test 3 is one in the tree view that is checked (selected for run).
You may choose to place some code in OnEndTest that will call the next test after the current test is completed. For
example, in OnEndTest you can check the Test.Id or Test.Number or Test.Index to figure out what test was completed,
you can also check Test.Status or check some global boolean variables or some number that will tell you what is the next
test/task to execute. (Task.Id and Test.Id are unique in the application.)
The test-specifier can be an integer, string, or object expression. If test-specifier is a string expression, it should be the Id
of any Test in the current program. If test-specifier is an object expression, it should be the Test object for any Test in the
current program.
If test-specifier is an integer expression, it should be the test number (1-based) of a test in the current Task. For example,
the following statement
Statements
103
Test 5
will jump to Test 5 (fifth test) of the current Task. If the fifth test does not exist, the statement will jump to next Task.
A Test number of -1 or 0 or any invalid number will terminate the current task.
Unless the EndEvents optional keyword is specified, the OnEndTest and OnEndTask events are not triggered for the
current test and task which are being terminated. When Test statement is called within OnInitProgram, OnInitTask,
OnInitTest, OnInit, or any other event, if the EndEvents optional keyword is specified, the OnEndTest and OnEndTask
events will be called before starting the new test.
The statement generates a run-time error if test-specifier does not refer to a valid test (invalid expressions like 9.9), if a
program is not being run, or if the program is being run in a special mode (such as Loop Test or Loop Task).
The optional keywords [ Uut lUutIndex] are new from ATEasy v8. The Uut clause marks the specified UUT index (see
App.UutIndex) as pending jump to the specified Test. When ATEasy switches to the UUT, the jump to the specified Test
will be done.
Example
The following example of an OnEndTest event procedure will retry each failed Test three times. If the Test continues to
fail the Task is terminated:
Procedure OnEndTest(): Void Public
{
If TestStatus = FAIL
If iRetryCount < 4
iRetryCount = iRetryCount + 1
Test GetTestNum ( )
Else
Test -1
Endif
Else
iRetryCount=0
Endif
}
See Also
About Module Events, Initialization Events, End Events, OnEndTest, GetTaskTests, GetTestNum, Task Statement, Task
Variable, Test Variable, App.UutIndex
Trace Statement
Appends expressions converted to strings to the built-in Debug Log window.
Syntax
Trace [ Using sFormatSpec ; ] [ [ Expression ] [ , ] [ ; ]... ]
ATEasy Programming Language
104
Comments
The Trace statement is used to print text to the Debug Log. It operates in exactly the same manner as the Print
statement, except its output goes to the Debug Log.
If the Trace statement is not ended with a comma (,) or a semicolon (;) the print position is moved to the beginning of a
new line after ATEasy outputs the string. A new line can also be generated by embedding the characters \r\n or \n inside
a string Expression.
A comma can be used to move the print position to the beginning of the next Tab, which is the next position that can
divided by 15.
A semicolon can be used as a separator between Expressions without moving the print position.
The Expression can be a string-exp or a simple (not array) numeric-exp. Each numeric-exp is converted to a string that
contains a leading space if the number is positive and the minus (-) if the number is negative. The format of a converted
numeric-exp to string is the same as the Str function (with iBase as 10).
The optional Using clause is used to format numeric values. The sFormatSpec is a string-exp that has the same syntax
as the sFormatSpec used by the Format function. After the semicolon in the Using clause, only numeric-exps are allowed
as Expressions.
Example
Trace "ATEasy";
Trace " is"; " Easy"
Trace 4*5,
Trace "ATE"; "Easy"
!This will print:
!ATEasy is Easy
!20 ATEasy
Trace using "###.###"; 1.45
Trace using "###.###"; -1.45
Trace using "###.###"; -99.4523
Trace using "###.###"; 2344.9549
Trace using "###.###E###"; 2344.9549
!This will print:
! 1.450
! -1.450
!-99.452
! 2344.955
! 23.450E+02
See Also
Chr, Format, Print, Str
Statements
105
Try Statement
Provides a way to catch run-time errors and handle errors locally before ATEasy proceed to handle errors using the
module OnError event.
Syntax
Try
[ statements ]
[Catch [ Module modulename[,]] | [errornumber1 To Errornumber2 |
ErrorNumber3[,...]]
[ statements1 ]...]
[Catch Else
[ statements2 ]]
EndTry
Comments
The Try-Catch block is used to localize the handling of any errors and exceptions which occur in a specific block of
statements, which means that a specific response can be tailored to the purpose of the block of statements. For example,
if an I/O table failed since the instrument was not responding, the statement can be used to catch the exception generated
by ATEasy in order to reset the instrument and then to retry the failed command.
ATEasy executes the statements then, if and exception was generated during executing statements the first Catch block
is tested if the exception matches the error numbers in the Catch blocks and or the modulename, statements1 is
executed or else the optional Catch Else statements2 are executed. After catch statements are executed the control goes
to the statement following the EndTry. If there is no match in any Catch statement in the current Try-Catch block, the
caller Try-Catch block is checked. If all the active Try-Catch blocks are been checked without a match, the error is
passed to the module OnError events.
The optional Module is used to catch errors only from the specified modulename. modulename can be Program,
System, Driver or any of the current system drivers names (e.g. DMM). Error numbers are used to catch only specific
error numbers or range of numbers. If multiple error numbers or error range they must be separated by commas. Using
the module block without the error numbers block allows you to catch all errors generated from the module.
Exceptions can be generated using the Error statement or when a run-time error occurs. Recoverable error are typically
generated by ATEasy as result of run-time error that occur when Instrument is not responding or COM objects methods
or properties that failed when called. Errors raised by the Error statement are also recoverable. Other run-time errors
such as divide by zero are non-recoverable (fatal).
You may use the Retry and Ignore statements to handle error in a catch block. Using Retry is only allowed for
recoverable errors. If the error was a recoverable error, the error processing code after the Catch statement can execute
an Ignore statement to continue execution immediately after where the error occurred or a Retry statement to transfer
control back to the statement generated the error and repeat the statement. Using Ignore statement will resume control to
the statement following the statement caused the error.
Alternatively, the error processing code can pass the error on to an outer Try block or to the Module OnError events. The
Error statement with no parameters can be used to re-throw the error. In this case the error number, message, and
location are unchanged. If the error was recoverable, a subsequent Ignore statement will continue from the original
location of the error. The Error statement with an error number and optional error message clears the old error condition
and creates a new one.
Try-Catch blocks can be explicitly nested, that is, one or more of the statements in statements1 can be a Try-Catch
block. The more usual case is that one or more of the statements in statements1 is a call to a procedure which contains
its own Try-Catch block(s) to deal with errors locally.
Example
The following is an example of a Try-Catch block which deals with DMM instrument commands:
ATEasy Programming Language
106
iRetryCount = 0
Try
DMM Measure (dVolts)
Switch Open (1)
Catch Module DMM, 332, 333, 340 to 500
iRetryCount = iRetryCount + 1
If iRetryCount > 3 Then ExitTest
DMM Reset
Retry
Catch Module DMM ! other DMM errors
DMM Reset
Ignore
Catch else ! other errors e.g SWITCH
! other error
TestStatus=Fail
ExitTest
EndTry
See Also
Error, Ignore, Retry, OnError Event
Unload Statement
Unloads a form.
Syntax
Unload frmVar
Comments
The Unload statement destroys the window which represents the visible part of the form on the screen.
Before a form is unloaded, the OnQueryUnload event occurs, followed by the OnUnload event. Setting the pbCancel
argument to True in either of these events prevents the form from being unloaded. For MDIForm objects, the following
event procedures occur in the following order:
The MDIForm object's OnQueryUnload event procedure
An OnQueryUnload event procedure for each MDI child form
An OnUnload event procedure for each MDI child form
The MDIForm object's OnFormUnload event procedure.
Statements
107
When a form is unloaded, all controls placed on the form at run-time are no longer accessible. Any run-time changes to
those controls and their properties are lost when the form is reloaded. All changes to form properties are also lost.
When a form is unloaded, only the displayed component is unloaded. The form object, its variables, and its procedures
are still accessible until the form object is deleted.
The form object can be explicitly and completely destroyed by assigning Nothing to frmVar. If frmVar is a local variable,
the form object will be destroyed when the procedure or event returns.
When using the Unload statement within the form you want to unload, use the Form internal variable.
You can call Unload statement on a form many times only the first will be processed.
Example
The first example unloads a form, frmMain. In the second example, a button event is set to unload the form containing the
button, btnCancel. Here, the reference is to the Form object, Form, rather than to the name of the form variable.
Unload frmMain
btnCancel OnClick
{
unload Form
}
See Also
AForm Class, Load Statement, OnInitialize Event (AForm), OnLoad Event (AForm), OnQueryUnload Event (AForm),
OnTerminate Event (AForm), OnUnload Event (AForm),
Loading and Unloading Events

While Statement
Executes Statements repeatedly while the specified bool-exp is True.
Syntax
While bool-exp [Do]
Statements
Endwhile
Comments
ATEasy first evaluates the bool-exp. If the result is zero, the control is transferred to the statement that follows the
Endwhile. Otherwise, Statements are executed and the While...Endwhile statement is executed again. The Do
statement is optional.
Example
i=0
While i < 2
i=i+1
Print i;
ATEasy Programming Language
108
EndWhile
! i is now 2
! This will print 1 2
See Also
Continue, Exitloop, Expressions, For, Loop, Repeat
UnloadLibrary Statement
Version 7

Unloads a DLL library.
Syntax
UnloadLibrary DllLibrary
Comments
The UnloadLibrary statement unloads a DLL library. The argument is a DLL name symbol that previously inserted under
submodule Libraries. The DLL name must be marked as public if the Unload statement is called from external module.
The DLL could be any DLL including an ATEasy DLL. When the DLL is unloaded it is removed from the process memory
if the DLL reference count is 0 at that point the DLL LibMain (or OnEndSystem/OnEnd events for ATEasy DLL) will be
called notifying the DLL that it is about to be unloaded from the memory.
Unloading or Loading a DLL allows the application to switch the modules DLLs implementation with another DLL. This can
be useful when creating generic driver that its implementation can be changed by replacing a DLL.
Example
The following example unloads the gxsw32 library:

UnloadLibrary gxsw32
The following example unloads gxsw32 DLL of the module MUX:

UnloadLibrary MUX.gxsw

See Also
LoadLibrary

109
Index

110
r
- 1
- Operator ................................................................. 1
!
! 74
Comment Statement .............................................. 74
#
#else ........................................................................... 67
#ifdef Statement ..................................................... 67
#endif .......................................................................... 67
#ifdef Statement ..................................................... 67
#ifdef ........................................................................... 67
#ifdef Statement ..................................................... 67
&
& 1
& Operator ................................................................ 1
(
( 1
( ) Operator ............................................................... 1
)
) 1
( ) Operator ............................................................... 1
.
. 1
. Operator ................................................................. 1
[
[ 1
[ ] Operator ............................................................... 1
]
] 1
[ ] Operator ............................................................... 1
^
^ 1
^ Operator................................................................. 1
<
< 1
< Operator ................................................................ 1
<= 1
<= Operator .............................................................. 1
<> 1
<> Operator .............................................................. 1
=
= 1
= Operator ................................................................ 1
Assignment Statement ........................................... 70
>
> 1
> Operator ................................................................ 1
>= 1
>= Operator .............................................................. 1
A
Abort ........................................................................... 67
Abort Statement ..................................................... 67
AddHandler .................................................................. 68
AddHandler Statement .............................................. 68
and ................................................................................ 1
and Operator ............................................................ 1
Any Data Type ............................................................ 17
Append ......................................................................... 72
Append Statement ..................................................... 72
Arguments .................................................................. 50
Compatible Argument Types ................................. 50
Procedure Parameters ........................................... 49
Array Literals .............................................................. 39
Array, Val, and Var Procedure Parameters ................ 49
Arrays ......................................................................... 19
Arrays and Structs ................................................. 23
Arrays and Variants ............................................... 21
Arrays as Procedure Arguments ............................ 24
Assignment of Arrays ............................................. 22
Calculating array dimension size ........................... 19
Definition ................................................................ 19
Dimensions of Arrays ............................................. 19
Maximum Size ....................................................... 19
Slices ..................................................................... 19
Strings as Arrays .................................................... 20
Assignment ................................................................. 70
Assignment Statement ........................................... 70
ATEasy Programming Language ................................. 1
B
Basic Data Types
Any Data Type ....................................................... 17
Bool Data Type ...................................................... 13
List of Basic Data Types .......................................... 7
Numeric Data Types .............................................. 10
Object Data Type ................................................... 16
Procedure Data Type ............................................. 15
String Data Types .................................................. 12
Variant Data Type .................................................. 13
Binary Literal ............................................................... 35
Binding ........................................................................ 57
Early ....................................................................... 57
Late ........................................................................ 57
Block Comments ........................................................ 74
Bool ............................................................................ 13
Bool Data Type ...................................................... 13
bool expression ............................................................ 1
Byte ............................................................................ 10
Byte Data Type ...................................................... 10
C
Calculating array dimension size ................................ 19
Case ........................................................................... 93
Select Statement .................................................... 93
Catch .......................................................................... 99
Try Statement ........................................................ 99
Index
111
Char ............................................................................ 10
Char Data Type ...................................................... 10
Code
Calling Procedures ................................................. 52
Where to Create and Use Procedures ................... 52
COM ............................................................................ 60
CreateObject Procedure ......................................... 57
Early Binding vs. Late Binding ................................ 57
GetObject Procedure .............................................. 58
Using COM Properties ........................................... 59
COM Methods ............................................................. 60
Calling .................................................................... 60
Command ................................................................... 73
Command Statement ............................................. 73
Comment .................................................................... 74
Comment Statement .............................................. 74
Compatible Argument Types ...................................... 50
Continue ...................................................................... 75
Continue Statement ................................................ 75
Conventions
Conventions for Naming Objects .............................. 9
Conventions for Naming Variables ..................... 8, 29
Creating
Procedures ............................................................. 52
Currency ..................................................................... 10
Currency Data Type ............................................... 10
Currenty Data Conversion ...................................... 44
D
Data Conversions
Logical and Bitwise Data Conversions ................... 43
Logical/Bitwise Operator ........................................ 43
Numeric Data Conversions .................................... 43
Numeric Operator ................................................... 43
Data Types
Any Data Type ........................................................ 17
Bool Data Type ....................................................... 13
BString Data Type ................................................ 13
Byte Data Type ....................................................... 10
Char Data Type ...................................................... 10
Currency Data Type ............................................... 10
Data Type Promotion ............................................. 43
DateTime Data Type .............................................. 10
DDWord Data Type ................................................ 10
DLong Data Type ................................................... 10
Double Data Type .................................................. 10
DWord Data Type ................................................... 10
Enumerated Data Types ........................................ 26
Float Data Type ...................................................... 10
List of Basic Data Types ........................................... 7
Long Data Type ...................................................... 10
Numeric Data Conversions .................................... 43
Numeric Data Types ............................................... 10
Object Data Type ................................................... 16
Object Naming Conventions ..................................... 9
Procedure Data Type ............................................. 51
Short Data Type ..................................................... 10
String Data Type .................................................... 12
User Data Type ...................................................... 27
Variable Naming Conventions ............................ 8, 29
Variant Data Type .................................................. 13
WChar Data Type ................................................... 10
Word Data Type ..................................................... 10
DateTime .............................................................. 10, 11
DateTime Data Conversion .................................... 44
DateTime Data Type .............................................. 11
DDWord ........................................................................ 7
DDWord Data Type .................................................. 7
Debug Log
Trace Statement .................................................... 98
Descof .......................................................................... 1
div ................................................................................. 1
div Operator ............................................................. 1
DLong ........................................................................... 7
DLong Data Type ..................................................... 7
Do ....................................................................... 78, 102
For Statement ........................................................ 78
While Statement ................................................... 102
Double ........................................................................ 10
Double Data Type .................................................. 10
Downto ....................................................................... 78
For Statement ........................................................ 78
DWord .................................................................... 7, 10
DWord Data Type .............................................. 7, 10
E
Early Binding .............................................................. 57
Else ............................................................................. 80
If Statement ............................................................ 80
Elseif ........................................................................... 80
If Statement ............................................................ 80
EndEvents ................................................ 76, 92, 96, 97
Endif ........................................................................... 80
#ifdef ...................................................................... 67
If Statement ............................................................ 80
Endloop ...................................................................... 85
Loop Statement ...................................................... 85
EndSelect ................................................................... 93
Select Statement .................................................... 93
Endtry ......................................................................... 99
Try Statement ........................................................ 99
Endwhile ................................................................... 102
While Statement ................................................... 102
Enum .......................................................................... 26
Enumerated Data Type .......................................... 26
Enumerated ................................................................ 26
Enumerated Data Type .......................................... 26
Error ............................................................................ 75
Error Statement ...................................................... 75
Escape Sequences for Literals ................................... 40
Exit .............................................................................. 76
Exit Statement ........................................................ 76
Exitloop ....................................................................... 77
Exitloop Statement ................................................. 77
ExitProgram Statement .............................................. 77
ExitTask ...................................................................... 77
ExitTask Statement ................................................ 77
ExitTest ....................................................................... 78
ExitTest Statement ................................................. 78
Expressions .................................................................. 1
ATEasy Programming Language
112
F
Float ............................................................................ 10
Float Data Type ...................................................... 10
Floating Point Literals ................................................. 37
For ............................................................................... 78
For Statement ......................................................... 78
Function Call ............................................................... 79
Function Call Statement ......................................... 79
G
Goto ............................................................................ 80
Goto Statement ...................................................... 80
I
Identifiers ...................................................................... 1
If 80
If Statement ............................................................ 80
ifdef ............................................................................. 67
Ifdef Statement ....................................................... 67
Ignore .......................................................................... 82
Ignore Statement .................................................... 82
Index
Indexes in Arrays .................................................... 19
Integer Expression ........................................................ 1
Integer Literals ............................................................ 35
IO Tables .................................................................... 55
L
Label
Goto Statement ...................................................... 80
Late binding ................................................................ 57
Load ............................................................................ 82
Load Statement ...................................................... 82
LoadLibrary .................................................................. 85
Load Library Statement ............................................. 85
Long ............................................................................ 10
Long Data Type ...................................................... 10
Loop ............................................................................ 85
Loop Statement ...................................................... 85
M
mod ............................................................................... 1
mod Operator ........................................................... 1
Multi Line Comments .................................................. 74
Multiple UUT Testing
Run Statement........................................................... 92
N
New ............................................................................... 1
new operator ............................................................ 1
New Operator ................................................................ 1
Next ............................................................................. 78
For Statement ......................................................... 78
not ................................................................................. 1
not Operator ............................................................. 1
Numeric Data Conversions ......................................... 43
Numeric Data Types ................................................... 10
Numeric Expression ..................................................... 1
O
Object Data Type ........................................................ 16
Object Expression ........................................................ 1
Object Naming Conventions ......................................... 9
OnReset ..................................................................... 89
Operators ...................................................................... 1
or 1
or Operator ............................................................... 1
P
Parameters ................................................................. 49
Procedure Parameters ........................................... 49
Pause ......................................................................... 86
Pause Statement ................................................... 86
Pointers ........................................................................ 1
& Operator ............................................................... 1
Predefined Symbols (Conditional Compilation) .......... 67
Preserve ..................................................................... 88
ReDim Statement ................................................... 88
Print ............................................................................ 87
Print Statement ...................................................... 87
procedure data type.................................................... 15
procedure expression ................................................... 1
Procedures
Arrays, Val and Var Parameters ............................ 49
Calling and Searching for Procedures ................... 52
Compatible Argument Types ................................. 50
Defining a Procedure Parameter ........................... 49
Parameters ............................................................ 49
Return Type ........................................................... 51
Returning Values ................................................... 51
Types ..................................................................... 49
Var Parameter ........................................................ 49
Procedures Overview ................................................. 49
Programming Language ............................................... 1
Properties ................................................................... 55
Classes, Properties, Methods and Events ............. 55
R
ReDim ......................................................................... 88
ReDim Statement ................................................... 88
RemoveHandler ............................................................ 88
RemoveHandler Statement......................................... 88
Repeat ........................................................................ 89
Repeat Statement .................................................. 89
Reset .......................................................................... 89
Reset Statement .................................................... 89
Retry ........................................................................... 90
Retry Statement ..................................................... 90
Return ......................................................................... 91
Return Statement ................................................... 91
Return Type ................................................................ 51
Returning Values in Procedure Code ......................... 51
Run .............................................................................. 92
Index
113
Run Statement........................................................... 92
Run Statement ............................................................... 92
S
Scope .......................................................................... 63
Member Operator ................................................... 64
Public Attribute ....................................................... 65
Public Members ...................................................... 65
Scope Resolution Operator .................................... 64
Scope Rules ........................................................... 63
Searching .................................................................... 52
Searching for Procedures ....................................... 52
Select .......................................................................... 93
Select Statement .................................................... 93
shl ................................................................................. 1
shl Operator .............................................................. 1
Short ........................................................................... 10
Short Data Type ..................................................... 10
shr ................................................................................. 1
shr Operator ............................................................. 1
sizeof ............................................................................. 1
sizeof Operator ......................................................... 1
Statements ............................................................ 85, 89
#Ifdef Statement ..................................................... 67
Abort Statement ..................................................... 67
AddHandler Statements ............................................. 68
Append Statements .................................................... 72
Assignment Statement ........................................... 70
Command Statement ............................................. 73
Comment Statement .............................................. 74
Continue Statement ................................................ 75
Error Statement ...................................................... 75
Exit Statement ........................................................ 76
Exitloop Statement ................................................. 77
ExitTask Statement ................................................ 77
ExitTest Statement ................................................. 78
For Statement ......................................................... 78
Function Call Statement ......................................... 79
Goto Statement ...................................................... 80
If Statement ............................................................ 80
Ifdef Statement ....................................................... 67
Ignore Statement .................................................... 82
Load Statement ...................................................... 82
Loop Statement ...................................................... 85
Pause Statement .................................................... 86
Print Statement ....................................................... 87
RemoveHandler Statement ......................................... 88
Repeat Statement .................................................. 89
Reset Statement ..................................................... 89
Retry Statement ..................................................... 90
Return Statement ................................................... 91
Run Statement........................................................... 92
Select Statement .................................................... 93
Subroutine Call Statement ..................................... 94
Task Statement ...................................................... 96
Test Statement ....................................................... 97
Trace Statement ..................................................... 98
Try Statement ......................................................... 99
Unload Statement ................................................. 101
While Statement ................................................... 102
String Data Types ....................................................... 12
String Expression .......................................................... 1
String Literals .............................................................. 38
Struct ........................................................................... 26
Structure Data Type ................................................... 26
Structures
Struct/Variant Data Conversion ................................. 45
Structure Data Type ............................................... 26
Subroutine .................................................................. 51
Subroutine Call ........................................................... 94
Subroutine Call Statement ..................................... 94
T
Task ............................................................................ 96
Task Statement ...................................................... 96
Test ............................................................................. 97
Test Statement ....................................................... 97
Then ........................................................................... 80
If Statement ............................................................ 80
To 78
For Statement ........................................................ 78
Trace .......................................................................... 98
Trace Statement .................................................... 98
Trace Using ................................................................ 98
Try .............................................................................. 99
Try Statement ........................................................ 99
TypeDef ...................................................................... 27
TypeDef Data Type ................................................ 27
typeof ............................................................................ 1
typeof operator ......................................................... 1
U
Unload ...................................................................... 101
Unload Statement ................................................ 101
UnloadLibrary ............................................................ 102
UnloadLibrary Statement ........................................ 102
Until ............................................................................ 89
Repeat Statement .................................................. 89
User Defined Data Types
Enumerated ........................................................... 26
Structures ............................................................... 26
TypeDef ................................................................. 27
Using .................................................................... 87, 98
Print Statement ...................................................... 87
Trace Statement .................................................... 98
V
Val
Val Parameter ........................................................ 49
Var Parameter ............................................................ 49
Variable Naming Conventions ................................ 8, 29
Variables
Parameters in Procedures ..................................... 49
Properties ............................................................... 31
Variant ........................................................................ 13
Variant Data Type .................................................. 13
Variant Expression ....................................................... 1
W
WChar ........................................................................ 10
WChar Data Type .................................................. 10
While ......................................................................... 102
ATEasy Programming Language
114
While Statement ................................................... 102
Word ........................................................................... 10
Word Data Type ..................................................... 10
X
xor ................................................................................. 1
xor Operator ............................................................. 1

You might also like