General Rules and Syntax of AutoScript
General Rules
The structure of the language is straightforward. Like a “simple basic.“ When writing AutoScript, the following rules apply.
Letter case matters. For example, New and NEW are different variables.
Commands never continue to the following line.
Arrays of one dimension are permitted.
We do not have a declaration of variables. The appearance of variables in the code is declaring the variables automatically. If a variable appears later as an array variable, it converts to an array having the largest index dimension.
The first element of an array has an index of (1), i.e., A[1].
All variables are of variant type. They behave relatively in the context they used. For example:
a = “Peter“
b = a + 1 {....b = 1}
b = 10 + b {.... b = 11}
b = strcat(a,“ and John“) {....b = “Peter and John“}
Functions must be calculated in a separate line. For example instead of:
a = 10*value(x,z) + 10
write
a = value(x,z)
a = 10*a + 10
Syntax
We give the vocabulary of AutoScript by using small examples.
if … then
if ( wage > 5000) then
msg = “The wage is big.“
endif
or
if ( wage < 2000 ) then
msg = “small wage“
elseif ( wage >= 2000) and ( wage < 5000) then
msg = “regular wage“
else
msg = “high wage“
endif
for … next
for i = 1to100
A[i] = i * 10
next
or
j = 2
for i = 1 to 100 step j
A[i] = i * 10
next
or
for i = 1 to 100
A[i] = i * 10
if (A[i] = 30) then
i = 100
endif
next
proc … end
proc showmessage( msg )
call message(“the message is:“ , msg)
end
fun … end
fun final_value(a,b,c)
result = a + b + c
end
call
call showmessage(msg)
or
call showmessage(“new message“)
return
if ( stop1 = True ) then
return
endif
start_sql … end_sql
start_sql “query_name“ “KOSMOS“
SELECT *
FROM PRODUCTS
end_sql
In the above lines of code, we declare the query. The execution takes part by calling the procedure RunEmbSQL.