Navigation: TextEd > Extension and Scripts >

Script structure

 

 

 

 

The PascalScript structure is the same as in Object Pascal language


 

#language PascalScript // this is optional
program MyProgram;     // this is optional
 
uses 'unit1.pas', 'unit2.pas'// Optional. Uses section - must be before any other sections
 
var                    // Var section   
  i, j: Integer;
 
const                  // Const section
  pi = 3.14159;
 
function p1(n: Integer): Integer;    // Procedures and functions
var
  i: Integer;                        // Nested procedures are possible
begin
  ...
  Result := i+n;
end;
 
// Main procedure that will be executed when you run the script.
begin
  for i := 0 to 10 do
  begin
    j := p1(i);
    ...
  end;
end.


 

The C++Script structure is


 

#language C++Script    // this is optional
#include "unit1.cpp", "unit2.cpp" 
 
int i, j;              // var section
 
#DEFINE pi = 3.14159   // const section
 
void p1()              // procedures and function
{
  ...                  // there is no nested procedures in C++Script
}
 
// Main procedure that will be executed when you run the script.
{
  ...
}


 

 

The JScript structure is


 

#language JScript      // this is optional
import "unit1.js", "unit2.js" 
// import section - must be before any other sections
 
var i, j = 0;          // var section
 
function p1()          // procedures and function
{
  ...                 
}
 
// Main procedure that will be executed when you run the script.
p1();
for (i = 0; i < 10; i++) j++;


 

 

The BasicScript structure is


 

#language BasicScript  'this is optional
imports "unit1.vb", "unit2.vb" 
'Imports section - must be before any other sections
dim i, j = 0           ' var section
 
function f1()          ' procedures and function
  'My function code
  ...
end function          
 
sub p1()
  'My sub code
  ...
end sub
                        
'Main procedure that will be executed when you run the script.
for i = 0 to 10
  p1()
next


 

 

 

 

 

 

 

 

Copyright © 2024 Rickard Johansson