UebergeordnetesD.bmp Grundlegende Informationen zur Administration finden Sie unter: Administration von Benutzern, Gruppen und Rollen

Allgemein

  • begin .. end constructor
  • procedure and function declarations
  • if .. then .. else constructor
  • for .. to .. do .. step constructor
  • while .. do constructor
  • repeat .. until constructor
  • try .. except and try .. finally blocks
  • case statements
  • with statements
  • as / is statements
  • array constructors (x:=[ 1, 2, 3 ];)
  • ^ , * , / , and , + , - , or , <> , >=, <= , = , > , < , div , mod , xor , shl , shr operators

Syntax

Identifiers

Identifier names in script (variable names, function and procedure names etc.) follow the most common rules in pascal:
Should begin with a character (a..z or A..Z), or '_', and can be followed by alphanumeric chars or '_' char. Cannot contain any other character or spaces.

Assign Statements

-->Just like in Pascal, assign statements (assign a value or expression result to a variable or object property) are built using
":=". Examples:
MyVar:=2;

Character strings

Strings (sequence of characters) are declared in pascal using single quote (') character. Double quotes (") are not used.
A:='This is a text';

Comments

Comments can be inserted inside script. You can use // chars or (* *) or { } blocks. Using // char the comment will finish at the end of line.
 
//This is a comment before ShowMessage
BMD_ShowMessage('Ok');
(* This is another comment *)
BMD_ShowMessage('More ok!');
{ And this is a comment
with two lines }
BMD_ShowMessage('End of okays');

Variables

There is no need to declare variable types in script. Thus, you declare variable just using var directive and its name. There is no need to declare variables if scripter property OptionExplicit is set to false. In this case, variables are implicit declared.

Examples:
SCRIPT 1:
procedure Msg;
var S;
begin
S:='Hello world!';
BMD_ShowMessage(S);
end;

Indexes

Strings, arrays and array properties can be indexed using "[" and "]" chars. For example, if Str is a string variable, the expression Str[3] returns the third character in the string denoted by Str, while Str[I + 1] returns the character immediately after the one indexed by I.
 
More examples:
MyChar:=MyStr[2];
MyStr[1]:='A';
MyArray[1,2]:=1530;

if Statements

There are two forms of if statement: if...then and the if...then...else. Like normal pascal, if the if expression is true, the statement (or block) is executed. If there is else part and expression is false, statement (or block) after else is execute.
 
Examples:
if J <> 0 then begin
Result := I/J;
Count := Count + 1;
end
else begin
Done := True;
End;

while Statements

A while statement is used to repeat a statement or a block, while a control condition (expression) is evaluated as true.
The control condition is evaluated before the statement. Hence, if the constrol condition is false at first iteration, the statement sequence is never executed. The while statement executes its constituent statement (or block) repeatedly, testing expression before each iteration. As long as expression returns True, execution continues.
 
Examples:

while I > 0 do begin
if Odd(I) then Z := Z * X;
I := I div 2;
X := Sqr(X);
end;

for Statements

Scripter support for statements with the following syntax: for counter := initialValue to finalValue do statement
For statement set counter to initialValue, repeats execution of statement (or block) and increment value of counter until counter reachs finalValue.
 
Examples:

for c:=1 to 10 do begin
a:=a+c;
end;

for i:=a to b do begin
j:=i^2;
sum:=sum+j;
end;

case Statements

Scripter support case statements with following syntax:
case selectorExpression of
caseexpr1: statement1;
...
caseexprn: statementn;
else
elsestatement;
end

If selectorExpression matches the result of one of caseexprn expressions, the respective statement (or block) will be
execute. Otherwise, elsestatement will be execute. Else part of case statement is optional. You can use expressions of any type in both selector expression and case expression.
 
Example:
case uppercase(Fruit) of
'lime': BMD_ShowMessage('green');
'orange': BMD_ShowMessage('orange');
'apple': BMD_ShowMessage('red');
else
BMD_ShowMessage('black');
end;

function and procedure declarations

Declaration of functions and procedures are similar to Object Pascal, with the difference you don't specify
variable types. Just like OP, to return function values, use implicited declared result variable. Parameters by reference can also be used, with the restriction mentioned: no need to specify variable types.
 
Some examples:
procedure HelloWord;
begin
BMD_ShowMessage('Hello world!');
end;

procedure UpcaseMessage(Msg);
begin
BMD_ShowMessage(Uppercase(Msg));
end;

function TodayAsString;
begin
Result:=DateToStr(Date);
end;

function Max(A,B);
begin
if A>B then
result:=A
else
result:=B;
end;

procedure SwapValues(var A, B);
Var Temp;
begin
Temp:=A;
A:=B;
B:=Temp;
end;

1097582601000001570.png