General Rules and Syntax of AutoScript

General Rules

The structure of the language is very simple. 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 next line.

Arrays of one dimension are permitted.

We do not have declaration of variables. The appearances of variables into the code declare automatically the variables. If a variable appears later as an array variable then converts to an array having as dimension the greatest index.

First element of an array has index of (1) i.e A[1]. 

All variables are of variant type. They behave relatively on 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 < 2000then

  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 )

      callmessage("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