home *** CD-ROM | disk | FTP | other *** search
/ PC Spiel 1996 July / PCS0796.ISO / werkstat / ter400 / tlan_001.exe / rar / PRSCRIPT.HLP < prev    next >
Text File  |  1996-04-19  |  53KB  |  1,630 lines

  1.  
  2.  ^hPreScription, The Terminate Programming Language^n
  3.  
  4.   IN NO EVENT WILL STRATHRORY SYSTEMS LIMITED, SERWIZ COMM OR ASSOCIATES BE
  5.   LIABLE TO YOU FOR ADDITIONAL DAMAGES, INCLUDING ANY LOST PROFITS, LOST
  6.   SAVINGS, OR OTHER INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE
  7.   USE OR INABILITY TO USE PRESCRIPTION OR SCRIPTS FOR PRESCRIPTION, EVEN IF
  8.   WE HAVE BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
  9.  
  10.   Terminate has an extended script programming language. It is not only
  11.   designed for logging onto a system and downloading a mail package, it
  12.   has been designed with a wider view in mind.
  13.  
  14.   As usual Terminate throws up the ball and gives you loads of options,
  15.   however if you want additional commands you cannot write yourself, then
  16.   just contact us and we will try to include your suggestions.
  17.  
  18.   If you have never done any programming before it might be a little
  19.   difficult to start out without prober guidance, however we have included
  20.   various simple examples which will help you get started more easily.
  21.  
  22.   If you do not know what programming means, perhaps learning this simple,
  23.   but yet powerful language can get you hook on the idea. You will not need
  24.   this language unless you have special needs that Terminate cannot solve.
  25.  
  26.   BUT please be aware when you start programming. Anything is possible.
  27.   That means that any possible error is also possible, and as Murphy's
  28.   law describes, if anything can go wrong it will go wrong. So please do
  29.   not blame us if something does goes wrong.
  30.  
  31.   ^hWhat can a script do for me ?^n
  32.  
  33.    A script can do many things. First of all it can automate some of your
  34.    daily needs. Many would use a script language for getting onto a system
  35.    and uploading and downloading mail packages or perhaps to check if there
  36.    is a new filelist and download it. There are really many more things
  37.    you can do easily.
  38.  
  39.   ^hCompiling scripts^n
  40.  
  41.    Before running a script Terminate will automatically detect if it has
  42.    been compiled and will compile it if necessary. The source code is in
  43.    files with the extension .TSL and the compiled ready to run script is
  44.    the .TSC file. It is possible to run .TSC files without having the
  45.    source code. Just access the Alt-G script menu or call Terminate with
  46.    the command line /SCRIPT:script to start a script.
  47.  
  48.    ^hInclude files^n
  49.  
  50.     The Include command enables you to put certain functions into smaller
  51.     files or libraries if you like. Just remember that the entire contents
  52.     are put into the finished compiled script.
  53.  
  54.     Include SCREEN.INC
  55.  
  56.     Will include the source code library called SCREEN.INC.
  57.  
  58.   ^hLanguage syntax^n
  59.  
  60.    You can enter all commands or system variables in both upper, lower or
  61.    mixed case. PRS will upper case everything while compiling, which means
  62.    you could both enter the command "Print" or "PRINT".
  63.    PRS will only keep the case of strings inside the " signs.
  64.    WriteStr x,1, "Hello"  would be translated to WRITESTR X,1,"Hello"
  65.  
  66.    If you make an error somewhere in your code you will be told at which
  67.    line the error occurred. However runtime errors will only be shown
  68.    at the time the error occurs. For example division by zero will
  69.    make your program abort.
  70.  
  71.   ^hComment lines^n
  72.  
  73.    Comment lines are used to make the source code more easily understood
  74.    the next time you or somebody else have to add or change something.
  75.    You could almost say the more comment lines the better, since they are
  76.    not compiled into the finished module and therefore do not take up
  77.    any memory. A comment can either be the only thing on the line or after
  78.    a command and must start with a % sign.
  79.  
  80.    Example:
  81.  
  82.      % This is a comment line only.
  83.      Set Turbo = "ON"              % Everything after here is comments.
  84.  
  85.    As a special compiler command you can use the "Comment". In this way
  86.    you can insert comments that can later be retrieved.
  87.    To insert your own copyright lines you could do:
  88.  
  89.     Comment "The Terminate PreScription demonstration script"
  90.     Comment "This script is (Freeware) 1995 by Bo Bendtsen"
  91.  
  92.    You can use 5 Comment lines each of 50 characters.
  93.  
  94.   ^hProgram structure^n
  95.  
  96.    A program consists of functions and variables. You can have as many
  97.    functions as you like and in any order you like. Making a structured
  98.    program can increase speed and make it easier to change. You do not need
  99.    to have functions or variables, you can simply use commands that are
  100.    built in. You can start immediately without any definitions or strange
  101.    syntaxes. One of the smallest scripts you can make could be one single
  102.    line like this:
  103.  
  104.       Print "Hello world"
  105.  
  106.   ^hVariables^n
  107.  
  108.    A simple programming language first of all needs variables. A variable is
  109.    like variable X and Y you perhaps learned about in school. It simply means
  110.    a given identifier can be assigned a value. With PreScription hereafter
  111.    always mentioned as "PRS" you have two kinds of variables called numbers
  112.    and strings.
  113.  
  114.    The limit on variables is 16000 but you will probably never need that
  115.    many or you will run out of memory first and it is always considered
  116.    best to use as few variables as possible.
  117.  
  118.    All variables are global variables which can be accessed from all parts
  119.    of the script. The syntax of a variable name is simple. It must begin
  120.    with a letter from A to Z and then can be followed by A-Z,0-9,_.
  121.  
  122.      Valid names:    Apple  Computer  X  X49  Cool_5_dude
  123.      Invalid names:  25XX   *Hello*   _NotMe
  124.  
  125.    ^hNumbers^n
  126.  
  127.     PRS uses something called floating point numbers. These numbers are
  128.     limited to 2.9e-39..1.7e38 which are very very large numbers, so you
  129.     should never be concerned about using too many decimals.
  130.  
  131.     Please note that all decimal number must use dot (.) and not comma (,)
  132.  
  133.     The numbers are used for storing information and for calculating,
  134.     here are a few examples that might help you understand better.
  135.  
  136.       Identifier   Value
  137.            |       |
  138.       Set Apples = 5
  139.  
  140.     The variable called Apples now has the value 5. If someone eats one of
  141.     the apples you can calculate:
  142.  
  143.       Set Apples = Apples - 1
  144.  
  145.     You now have 4 apples.
  146.  
  147.     Another example to calculate how much discount you got on your new modem
  148.  
  149.       Set NewModem = 495
  150.       Set Discount = 0.15
  151.       Set NewModem = NewModem * Discount
  152.  
  153.     The result in NewModem would now be 74.25
  154.  
  155.    ^hStrings^n
  156.  
  157.     Strings are characters after each other and could look like this:
  158.  
  159.       "This is a string"
  160.  
  161.     The " signs are to tell PRS when the string starts and stops.
  162.     A string can be up to 255 characters long and can have any value from
  163.     ASCII 0 to ASCII 255.
  164.  
  165.     Some examples:
  166.  
  167.       Set Part1 = "A Terminate "
  168.       Set Part2 = "a day keeps the doctor away"
  169.       Set Joke = Part1 + Part2
  170.  
  171.     To manipulate the strings there are many commands described later in
  172.     this document, please look at the examples and see how some of them
  173.     work.
  174.  
  175.   ^hExpressions and operators^n
  176.  
  177.    An expression is made out of operators and constants or variables.
  178.  
  179.    An expression could look like this:
  180.  
  181.         80186 + (301 - 1)
  182.         Carrier = "ON"
  183.         28800 / 2400 * 12
  184.         X = 500 < Y
  185.  
  186.    The operators PRS understands:
  187.  
  188.         +     Addition              <     Less than
  189.         -     Subtraction           >     Greater than
  190.         *     Multiplication        =     Equal to
  191.         /     Division              <>    Not equal to
  192.         \     Mod (remainder)       <=    Less than or equal to
  193.         ^     Power                 >=    Greater than or equal to
  194.         &     And
  195.         |     Or
  196.         !     Not
  197.  
  198.    The various operators have different priorities in order to determine
  199.    which ones to process first.
  200.  
  201.     Unary operators            !
  202.     Multiplying operators      * \ / & ^
  203.     Adding operators           + - |
  204.     Relational operators       = <> < > <= >=
  205.  
  206.    If you want different priorities just use the parentheses ()
  207.  
  208.      20 - 2  * 5 = 10    *  is higher than -
  209.     (20 - 2) * 5 = 90    () is higher than any operator.
  210.  
  211.   ^hUser defined functions^n
  212.  
  213.    Creating your own functions is useful when you do the same thing over
  214.    and over again or simply want a more structured program.
  215.  
  216.    A function is completely user defined and can contain either built-in
  217.    commands or calls to other functions you have made.
  218.  
  219.     Function CountTo100()
  220.       Set X=1
  221.       Repeat
  222.         GotoXY 1,1
  223.         Print x
  224.         Set X=X+1
  225.       Until X>100
  226.     EndFunc
  227.  
  228.    This simple function does nothing other than count to 100 on the top left
  229.    corner of your screen. You call the function by entering
  230.  
  231.     CountTo100()
  232.  
  233.    To send variables to a function you need to include the variable name
  234.    in the parentheses () like this:
  235.  
  236.     Function CountMore(HowMany)
  237.       Set X=1
  238.       Repeat
  239.         GotoXY 1,1
  240.         Print x
  241.         Set X=X+1
  242.       Until X>HowMany
  243.     EndFunc
  244.  
  245.    Now you can count to as many as you like. Enter:
  246.  
  247.     CountMore(50)
  248.  
  249.    And the function will count to 50.
  250.  
  251.    The harder part with understanding functions is to see how it can
  252.    be used to return results. Here is an easy example.
  253.  
  254.     Function HappyHour(Drinks)
  255.       Set ExtraDrinks = Drinks * 2
  256.     EndFunc ExtraDrinks
  257.  
  258.    To call the function you need to display or store the return value.
  259.    To display you could:
  260.  
  261.     PrintLn "Normal hours I get ",5," drinks"
  262.     PrintLn "When it is happy hour I get ",HappyHour(5)," drinks"
  263.  
  264.    If you want to store the result in another variable use the following:
  265.  
  266.     Set DrinkResult = HappyHour(5)
  267.  
  268.    A function can also return a value directly. Whatever is on the
  269.    EndFunc line will be returned as the result.
  270.  
  271.    Function names follow the same rules as variable names and must at
  272.    least end with () if no parameter is used.
  273.  
  274.    IMPORTANT: A function must be defined before it is called.
  275.  
  276.   ^hStatements^n
  277.  
  278.    PRS supports many basic statements which will be explained below.
  279.  
  280.    ^hIf Else Endif^n
  281.  
  282.     The If statement is used for evaluating an expression. You can use
  283.     it for testing if certain variables have a certain value like this:
  284.  
  285.      Set Apples = 6
  286.      If Apples > 5
  287.        Print "Plenty left"
  288.      Endif
  289.  
  290.     Since Apples is 6 you will see Plenty left printed on the screen. If
  291.     you set Apples = 5 or less then everything will be skipped until the
  292.     Endif.
  293.  
  294.     An If statement must always end with an Endif command, which tells PRS
  295.     that the statement stops here.
  296.  
  297.     The Else statement means what it says. If the If statement is false the
  298.     Else statement will be used.
  299.  
  300.      Set Apples = 4
  301.      If Apples > 5
  302.        Print "Plenty left"
  303.      Else
  304.        Print "Please buy more"
  305.      Endif
  306.  
  307.     Now Apples is 4 which makes the If statement false and you will see
  308.     Please buy more on your screen.
  309.  
  310.    ^hGoto Labels^n
  311.  
  312.     The Goto command is used to jump to other locations in your script.
  313.     You will need to define a label which uses the following format
  314.  
  315.      :LabelName
  316.  
  317.     The label follow the same rules as variable names and must start with
  318.     a colon :
  319.  
  320.     Some examples:
  321.  
  322.      :Start
  323.      :End
  324.  
  325.     The Goto command syntax: Goto LabelName
  326.  
  327.      :Start
  328.      PrintLn "Start"
  329.      Goto JumpJump
  330.      PrintLn "NeverMe"
  331.  
  332.      :JumpJump
  333.      PrintLn "Finished"
  334.  
  335.     PrintLn "NeverMe" will then be skipped.
  336.     Goto command should be avoided as much as possible since it creates
  337.     unstructured programs. Only use for simple small programs.
  338.  
  339.    ^hGosub Labels Return^n
  340.  
  341.     Gosub commands are almost the same as Functions except that you
  342.     cannot send any variables or get any results back. It simply carries
  343.     out a single task and returns to the previous location. If,for
  344.     example, you have a menu you want to display from several places in
  345.     your script using the Gosub command could save you having the same
  346.     menu twice. However it is recommended to use functions which are
  347.     more flexible. The Return command tells PRS to return to the next
  348.     line following the Gosub.
  349.  
  350.      Goto Main
  351.  
  352.      :Menu
  353.      PrintLn "Start"
  354.      Return
  355.  
  356.      PrintLn "NeverMe"
  357.  
  358.      :Main
  359.      Gosub Menu
  360.  
  361.   ^hLoops^n
  362.  
  363.    Loop statements are using for repeating the same commands a variable
  364.    number of times, until something is true or something is false.
  365.  
  366.    ^hFor Next^n
  367.  
  368.     For is used for performing the same commands a defined number of times.
  369.     For has 4 parameters that have to be given.
  370.  
  371.      For Variable,Start,End,Increase
  372.  
  373.     The variable is a normal variable.
  374.     Start is the starting value.
  375.     End is the ending value
  376.     Increase is the value to be increased after every Next command.
  377.     When Counter is equal to the ending value the script will proceed.
  378.  
  379.      For Counter,1,10,1
  380.        PrintLn Counter
  381.      Next
  382.  
  383.     Will display the numbers 1 - 10
  384.  
  385.      For Counter,10,1,-1
  386.        PrintLn Counter
  387.      Next
  388.  
  389.     Will display the numbers 10 - 1
  390.  
  391.    ^hWhile EndWhile^n
  392.  
  393.     This loop continues until the statement is false. In other words
  394.     while the statement is true all commands until the EndWhile will
  395.     be executed.
  396.  
  397.      Set Counter = 10
  398.      While Counter <= 20
  399.        PrintLn Counter
  400.        Set Counter = Counter + 1
  401.      EndWhile
  402.  
  403.     This will print out the numbers 10-20
  404.  
  405.    ^hRepeat Until^n
  406.  
  407.     Repeat is much like While except that Repeat continues until the
  408.     statement is true.
  409.  
  410.      Set Counter = 20
  411.      Repeat
  412.        PrintLn Counter
  413.        Set Counter = Counter - 1
  414.      Until Counter < 10
  415.  
  416.     This will also print out the numbers 20-10
  417.  
  418.   ^hStopping a script SHIFT-ESC, K^n
  419.  
  420.    If your script goes into an endless loop, you can force or at least
  421.    try to stop it by first pressing Shift-Esc and then K for Kill.
  422.  
  423.   ^hBuilt-in commands and functions^n
  424.  
  425.    In addition to your own variables you can use and change certain
  426.    pre-defined variables. A system function can, for example, tell you
  427.    how much memory you have left (FREEMEM). A system variable could be
  428.    ATTR which holds the current color attribute and which you can change
  429.    as you like. A command is just like a system function except that it
  430.    does not return anything.
  431.  
  432.    In the following section of the manual you will find 3 things:
  433.  
  434.     System commands   = Executes a command only, no value returned  (Command)
  435.     System functions  = Executes command and returns value          (Function)
  436.     System variables  = Like a normal variable which can be changed (Variable)
  437.  
  438.    Please note that all system variables are changed for the entire Terminate,
  439.    so be careful and if you change something, remember to set it back to the
  440.    original value afterwards. Please note the () which will be mentioned
  441.    for each description.
  442.  
  443.  
  444.    ^hScreen, sound handling^n
  445.  
  446.     ^hAttr^n               (Variable)
  447.  
  448.      Purpose: Current screen color attribute byte. Use the T-COLOR.EXE or the
  449.               color selector inside Terminate to find the colors you need.
  450.      Returns: 0-255
  451.      Example: Set Attr = 14       Set screen attribute to yellow
  452.               Set Color = Attr    Save the current attribute in variable
  453.  
  454.     ^hAttrBlock^n          (Command)
  455.  
  456.      Purpose: Fills an area on the screen with a certain attribute
  457.      Syntax : AttrBlock x1,y1,x2,y2,attribute
  458.      Example: AttrBlock 1,2,70,20,10
  459.               Fill area (1,2)-(70,20) with color attribute light green
  460.  
  461.     ^hBox^n                (Command)
  462.  
  463.      Purpose: Make a textbox on the screen using boxtypes and attributes
  464.      Syntax : Box x1,y1,x2,y2,attribute,boxtype
  465.               boxtype: 0=Blank, 1=Single, 2=Double, 3=Double top+single side,
  466.               4=Double side+single top, 5=* and -|, 6=Single top only,
  467.               7=Double top only
  468.      Example: Box 1,1,80,25,23,1
  469.               Draw a box on the screen using single boxes and gray on blue.
  470.      Notes  : Attribute is same format as the Attr variable
  471.  
  472.     ^hCharBlock^n          (Command)
  473.  
  474.      Purpose: Draws a block of the same character using default attribute
  475.      Syntax : CharBlock x1,y1,x2,y2,character
  476.      Example: CharBlock 1,1,80,25,"*"
  477.               Fills the entire screen with the * character
  478.  
  479.     ^hClearScreen^n        (Command)
  480.  
  481.      Purpose: Clears the entire screen, using the current attribute
  482.      Syntax : ClearScreen
  483.  
  484.     ^hCursor^n             (Command)
  485.  
  486.      Purpose: Cursor control
  487.      Syntax : Cursor cursortype
  488.               cursortype: 0 = Off, 1 = On, 2 = Max
  489.      Example: Cursor 0 Turns cursor off
  490.  
  491.     ^hFillBlock^n          (Command)
  492.  
  493.      Purpose: Fill an area on the screen, with an attribute and a character
  494.      Syntax : FillBlock x1,y1,x2,y2,attribute,character
  495.      Example: FillBlock 2,2,79,24,3,"#"
  496.               Fills the area (2,2)-(79,24) with # in the cyan color
  497.  
  498.     ^hGetAttrXY^n          (Function)
  499.  
  500.      Purpose: Returns attribute byte from screen on location x,y
  501.      Syntax : GetAttrXY(x,y)
  502.      Example: Set SaveColor = GetAttrXY 79,5
  503.               Sets SaveColor to the color of 79,5 on the screen
  504.  
  505.     ^hGetCharXY^n          (Function)
  506.  
  507.      Purpose: Returns the character from screen on location x,y
  508.      Syntax : GetCharXY(x,y)
  509.      Example: Set SaveChar = GetCharXY 1,1
  510.               Sets SaveChar to the character of position 1,1 on the screen
  511.  
  512.     ^hGotoXY^n             (Command)
  513.  
  514.      Purpose: Move cursor to location x,y
  515.      Syntax : GotoXY x,y
  516.      Example: GotoXY 40,12
  517.               Goto the middle of the screen
  518.  
  519.     ^hInWindow^n           (Variable)
  520.  
  521.      Purpose: Use Window offset for certain screen commands
  522.      Returns: 0 or 1
  523.      Example: Set InWindow=0
  524.               Current window offset not used
  525.               Set InWindow=1
  526.               Current window offset used
  527.               Does not work for Print, PrintLn, GotoXY
  528.  
  529.     ^hMouse^n              (Command)
  530.  
  531.      Purpose: Turn on/off the mouse
  532.      Syntax : Mouse action
  533.               action: 0=Off, 1=On
  534.      Example: Mouse 1
  535.               Turns on mouse
  536.  
  537.     ^hMouseDetected^n      (Functions)
  538.  
  539.      Purpose: Report if a mouse driver was detected
  540.      Syntax : MouseDetected
  541.      Returns: 0=No, 1=Yes
  542.      Example: If MouseDetected=1
  543.  
  544.  
  545.     ^hMouseGotoXY^n        (Command)
  546.  
  547.      Purpose: Sets mouse to X,Y on the screen
  548.      Syntax : MouseGotoXY x,y
  549.      Example: MouseGotoXY 1,1
  550.               Move mouse to top left corner
  551.  
  552.     ^hMouseLeft^n          (Functions)
  553.  
  554.      Purpose: Report if the left button was pressed
  555.      Syntax : MouseLeft
  556.      Returns: 0=No, 1=Yes
  557.      Example: If MouseLeft=1
  558.  
  559.     ^hMouseRight^n         (Functions)
  560.  
  561.      Purpose: Report if the right button was pressed
  562.      Syntax : MouseRight
  563.      Returns: 0=No, 1=Yes
  564.      Example: If MouseRight=1
  565.  
  566.     ^hMouseWindow^n        (Command)
  567.  
  568.      Purpose: Sets coordinates where mouse is visible
  569.      Syntax : MouseWindow x1,y1,x2,y2
  570.      Example: MouseWindow 5,10,15,70
  571.               Force mouse to be inside (5,10)-(15,70)
  572.  
  573.     ^hMouseX^n             (Functions)
  574.  
  575.      Purpose: Report the X position of the mouse
  576.      Returns: MouseX
  577.      Example: If MouseX<10
  578.  
  579.     ^hMouseY^n             (Functions)
  580.  
  581.      Purpose: Report the Y position of the mouse
  582.      Syntax : MouseY
  583.      Example: If MouseY>=25
  584.  
  585.     ^hNoSound^n            (Command)
  586.  
  587.      Purpose: Turn off sound soundcard or internal speaker
  588.      Syntax : NoSound
  589.  
  590.     ^hPrint^n              (Command)
  591.  
  592.      Purpose: Display a string on the screen at current cursor position
  593.      Syntax : Print expression
  594.      Example: Print "Hello world"
  595.               Displays hello on the screen
  596.               Print 25*10
  597.               Calculates result 250 and displays on screen
  598.  
  599.     ^hPrintLn^n            (Command)
  600.  
  601.      Purpose: Display a string on the screen and press enter
  602.      Syntax : PrintLn expression
  603.      Example: Same command as Print except that CR+LF is added to string
  604.  
  605.     ^hRemoveWindow^n       (Command)
  606.  
  607.      Purpose: Remove a window that was set by the Window command
  608.      Syntax : RemoveWindow
  609.               Removes top window from screen
  610.  
  611.     ^hScrCol^n             (Variable)
  612.  
  613.      Purpose: Holds the number of columns on the screen (80)
  614.      Returns: 40-132
  615.      Example: Print ScrCol
  616.               Displays the current number of columns on screen
  617.  
  618.     ^hScrLen^n             (Variable)
  619.  
  620.      Purpose: Holds the number of lines on the screen (25)
  621.      Returns: 25-60
  622.      Example: Print ScrLen
  623.               Displays the current number of lines on screen
  624.  
  625.     ^hScroll^n             (Command)
  626.  
  627.      Purpose: Scroll a region of the screen
  628.      Syntax : Scroll direction,x1,y1,x2,y2,positions,attribute
  629.               direction: 0=Clear, 1=uP, 2=DOWN, 3=LEFT, 4=RIGHT  a=attribute }
  630.               positions are number of columns or lines to scroll
  631.               attribute is the attribute to use in the cleared area
  632.      Example: Scroll 4,1,1,30,5,2,7
  633.               Scroll (1,1)-(30,5) to columns to the right, clear with gray
  634.  
  635.     ^hSelectBar^n          (Function)
  636.  
  637.      Purpose: The menubar selector option used in most menus in Terminate
  638.      Syntax : Selectbar(y,ylen,start,attr,barx1,barx2,bartxty)
  639.      Returns: 0-25
  640.      Example: Set x=SelectBar(1,3,x,113,1,20,0)
  641.               Menubar starts at in the top corner of the active window or
  642.               screen and is 3 lines long, starting on menuline x. Menubar
  643.               is color 113 and is visible from columns 1-20. No bartext is
  644.               available. Returns selection in x. 0=Esc pressed.
  645.      Notes  : SetBarTxt can be used to define helplines, set bartxty to
  646.               the line where you want it, ScrLen is normal, 0=disable
  647.  
  648.     ^hSetAttr^n            (Command)
  649.  
  650.      Purpose: Sets the current color attribute
  651.      Syntax : SetAttr attribute
  652.      Example: SetAttr 9
  653.               Set color to light blue
  654.  
  655.     ^hSetBarTxt^n          (Command)
  656.  
  657.      Purpose: Sets helplines for SelectBar
  658.      Syntax : SetBarTxt num,string
  659.      Example: SetBarTxt 1,"This is helpline 1"
  660.               When selectbar is in menu-position 1 this can be displayed
  661.  
  662.     ^hSound^n              (Command)
  663.  
  664.      Purpose: Sound a tune using the sound card or internal speaker
  665.      Syntax : Sound frequency
  666.      Example: Sound 440
  667.               Set the sound to the concert pitch
  668.  
  669.     ^hWhereX^n             (Function)
  670.  
  671.      Purpose: To return the current X position of the cursor
  672.      Returns: 1-132
  673.      Example: Print WhereX
  674.               Displays the current X position of the cursor
  675.  
  676.     ^hWhereY^n             (Function)
  677.  
  678.      Purpose: To return the current Y position of the cursor
  679.      Returns: 1-60
  680.      Example: Print WhereX
  681.               Displays the current Y position of the cursor
  682.  
  683.     ^hWindow^n             (Command)
  684.  
  685.      Purpose: Set a window and make it the current window for all functions
  686.      Syntax : Window x1,y1,x2,y2,boxtype,shadow,frameattr,txtattr,
  687.                      headerattr,headertxt
  688.               boxtype: Same as the box-command
  689.               shadow : 0=no-shadow, 1=shadowtype 1, 2=shadowtype 2
  690.      Example: Window 10,1,70,10,1,1,30,23,27," Test window "
  691.               Sets window at (10,1)-(70,10) using single boxes and shadowtype
  692.               1, blue background and various foreground and header as above.
  693.  
  694.     ^hWriteAStr^n          (Command)
  695.  
  696.      Purpose: Display a string at position x,y and change default color
  697.      Syntax : WriteAStr x,y,attribute,expression
  698.      Example: WriteAStr 1,1,11,"I am light cyan"
  699.               Displays the string at 1,1 in light cyan color
  700.  
  701.     ^hWriteAttr^n          (Command)
  702.  
  703.      Purpose: Write a single attribute at position x,y
  704.      Syntax : WriteAttr x,y,attribute
  705.      Example: WriteAttr 1,1,14
  706.               Change attribute at 1,1 to yellow
  707.  
  708.     ^hWriteChar^n          (Command)
  709.  
  710.      Purpose: Write a single character at x,y
  711.      Syntax : WriteChar x,y,character
  712.      Example: WriteChar 1,1,"X"
  713.               Displays X in position 1,1
  714.  
  715.     ^hWriteColorStr^n      (Command)
  716.  
  717.      Purpose: Display a string with several colors
  718.      Syntax : WriteColorStr x,y,expression
  719.      Example: WriteColorStr 1,1,"^014 Yellow ^007 Gray"
  720.               The ^014 means change to color 14 at this position. It is
  721.               the same values as the normal attribute color.
  722.  
  723.     ^hWriteStr^n           (Command)
  724.  
  725.      Purpose: Display a string at position x,y
  726.      Syntax : WriteStr x,y,expression
  727.      Example: WriteStr 1,1,"Hello world"
  728.               Writes the string at 1,1
  729.  
  730.    ^hKeyboard control^n
  731.  
  732.     ^hAltPressed^n         (Function)
  733.  
  734.      Purpose: Checks if a Alternate is pressed on the keyboard
  735.      Returns: 0=No, 1=Yes, Alt is being pressed
  736.      Example: If AltPressed=1
  737.  
  738.     ^hCtrlPressed^n        (Function)
  739.  
  740.      Purpose: Checks if a Control is pressed on the keyboard
  741.      Returns: 0=No, 1=Yes, Ctrl is being pressed
  742.      Example: If CtrlPressed=1
  743.  
  744.     ^hGetkey^n             (Function)
  745.  
  746.      Purpose: Retrieves a key from the keyboard, wait if no key is ready
  747.      Returns: 0-65535, value of key
  748.      Example: PrintLn(GetKey)
  749.               Display the value of the key pressed
  750.  
  751.     ^hInput^n              (Function)
  752.  
  753.      Purpose: Input a string on screen
  754.      Syntax : Input(x,y,length,textattribute,editattribute,string)
  755.      Returns: String
  756.      Example: Set Result=Input(1,1,40,11,3,"Input string")
  757.               Inputs a string at position 1,1 with the length of 40
  758.               characters on the colors cyan and light cyan.
  759.  
  760.     ^hKey^n                (Variable)
  761.  
  762.      Purpose: Hold the last keyboard code
  763.      Returns: 0-65535
  764.      Example: While Key<>13
  765.               While Escape is not pressed run the loop
  766.  
  767.     ^hKeyPressed^n         (Function)
  768.  
  769.      Purpose: Checks if a key has been pressed on the keyboard
  770.      Returns: 0=No key ready, 1=key ready to be read by Getkey
  771.      Example: While KeyPressed=0
  772.               While no key is pressed run the loop
  773.  
  774.     ^hShiftPressed^n       (Function)
  775.  
  776.      Purpose: Checks if a Shift is pressed on the keyboard
  777.      Returns: 0=No, 1=Yes, Shift is being pressed
  778.      Example: If ShiftPressed=1
  779.  
  780.     ^hWaitEnter^n          (Command)
  781.  
  782.      Purpose: Wait until someone presses the ENTER key
  783.      Syntax : WaitEnter
  784.  
  785.    ^hVariable manipulation^n
  786.  
  787.     ^hBlankAfter^n         (Function)
  788.  
  789.      Purpose: Add spaces after a string until a specified length is obtained
  790.      Example: BlankAfter(string,length)
  791.      Returns: String
  792.      Example: Print BlankAfter("Test",7)
  793.               Displays "Test   " on the screen
  794.  
  795.     ^hBlankBefore^n        (Function)
  796.  
  797.      Purpose: Add spaces before a string until a specified length is obtained
  798.      Example: BlankBefore(string,length)
  799.      Returns: String
  800.      Example: Print BlankBefore("Test",7)
  801.               Displays "   Test" on the screen
  802.  
  803.     ^hChr^n                (Function)
  804.  
  805.      Purpose: Converts a number to the ASCII value
  806.      Syntax : Chr(number)
  807.      Returns: Character #0-#255
  808.      Example: Set Val=Chr(200)
  809.  
  810.     ^hCopy^n               (Function)
  811.  
  812.      Purpose: Copy out part of a string
  813.      Example: Copy(string,start,characters)
  814.      Returns: String
  815.      Example: Print Copy("Test",1,2)
  816.               Displays "Te" on the screen
  817.  
  818.     ^hDelete^n             (Function)
  819.  
  820.      Purpose: Delete part of string
  821.      Syntax : Delete(string,index,characters)
  822.      Returns: String
  823.      Example: Print Delete("Hello",4,2)
  824.               Displays "Hel" on screen
  825.  
  826.     ^hGrabword^n           (Function)
  827.  
  828.      Purpose: Return a single word in a string
  829.      Syntax : GrabWord(expression,word-number)
  830.      Returns: String
  831.      Example: Print GrabWord("Hello World",2)
  832.               Displays "World" on screen
  833.  
  834.     ^hInteger^n            (Function)
  835.  
  836.      Purpose: Cut off all decimals and returner integer
  837.      Syntax : Integer(number)
  838.      Returns: Integer
  839.      Example: Print Integer(1.50)
  840.               Prints the number 1
  841.  
  842.     ^hLength^n             (Function)
  843.  
  844.      Purpose: Return the length of a string
  845.      Syntax : Length(string)
  846.      Returns: 0-255
  847.      Example: Print length("test")
  848.               Displays the number 4 on screen
  849.  
  850.     ^hNumchars^n           (Function)
  851.  
  852.      Purpose: Return a string with a number of the same characters
  853.      Syntax : Numchars(character,numbers)
  854.      Returns: String
  855.      Example: Print Numchars("-",5)
  856.               Displays "-----" on screen
  857.  
  858.     ^hOrd^n                (Function)
  859.  
  860.      Purpose: Converts an ASCII value to ordinary value
  861.      Syntax : Ord(number)
  862.      Returns: Character #0-#255
  863.      Example: Set Val=Ord("A")
  864.  
  865.     ^hParameter^n          (Function)
  866.  
  867.      Purpose: Return command line parameter when calling script
  868.      Syntax : Parameter(number)
  869.      Returns: String
  870.      Example: Set ComPort=Parameter(1)
  871.  
  872.     ^hPos^n                (Function)
  873.  
  874.      Purpose: Search for sub-string in string
  875.      Syntax : Pos(sub-string,string)
  876.      Returns: 0=Not found, 1=255 position found
  877.      Example: Print Pos("World","Hello World")
  878.               Displays the number 6 on screen
  879.  
  880.     ^hRound^n              (Function)
  881.  
  882.      Purpose: Round an real number
  883.      Syntax : Round(number)
  884.      Returns: Integer
  885.      Example: Print Round(1.49)   Prints the number 1
  886.               Print Round(1.50)   Prints the number 2
  887.  
  888.     ^hSet^n                (Command)
  889.  
  890.      Purpose: Assign a value to a variable
  891.      Syntax : Set variable name = value
  892.      Example: Set Result = 20*10
  893.               Set Apples = "Good tasting"
  894.  
  895.     ^hStLocase^n           (Function)
  896.  
  897.      Purpose: Lowercase a string
  898.      Syntax : StLocase(string)
  899.      Returns: String
  900.      Example: Print LoUpcase("HELLO")
  901.               Displays hello on screen
  902.  
  903.     ^hStUpcase^n           (Function)
  904.  
  905.      Purpose: Uppercase a string
  906.      Syntax : StUpcase(string)
  907.      Returns: String
  908.      Example: Print StUpcase("hello")
  909.               Displays HELLO on screen
  910.  
  911.    ^hStacks and queues^n
  912.  
  913.     A stack is a First-In-Last-Out buffer, which can be used for saving
  914.     variables or values that need to be used later.
  915.  
  916.     A queue is a First-In-First-Out buffer (FIFO) which can be used for
  917.     buffering variables.
  918.  
  919.     ^hQueueLook^n          (Command)
  920.  
  921.      Purpose: Retrieves the latest variable from the queue without popping
  922.      Syntax : QueueLook variable
  923.      Example: QueueLook Count
  924.               Count is set to latest value pushed on queue without popping
  925.  
  926.     ^hQueuePop^n           (Command)
  927.  
  928.      Purpose: Retrieve the latest variable pushed on the user-queue
  929.      Syntax : QueuePop variable
  930.      Example: QueuePop Count
  931.               Takes the latest pushed value from queue and puts into Count
  932.  
  933.     ^hQueuePush^n          (Command)
  934.  
  935.      Purpose: Pushes a variable on the user-queue to be retrieved later
  936.      Syntax : QueuePush variable
  937.      Example: QueuePush Count
  938.               Push Count on the user-queue
  939.  
  940.     ^hStackLook^n          (Command)
  941.  
  942.      Purpose: Retrieves the latest variable from the stack without popping
  943.      Syntax : StackLook variable
  944.      Example: StackLook Count
  945.               Count is set to latest value pushed on stack without popping
  946.  
  947.     ^hStackPop^n           (Command)
  948.  
  949.      Purpose: Retrieve the latest variable pushed on the user-stack
  950.      Syntax : StackPop variable
  951.      Example: StackPop Count
  952.               Takes the latest pushed value from stack and puts into Count
  953.  
  954.     ^hStackPush^n          (Command)
  955.  
  956.      Purpose: Pushes a variable on the user-stack to be retrieved later
  957.      Syntax : StackPush variable
  958.      Example: StackPush Count
  959.               Push Count on the user-stack
  960.  
  961.    ^hSerial interface handling^n
  962.  
  963.     All commands will return a resultcode in DeviceResult, if 0 the command
  964.     was executed succesfully.
  965.  
  966.     ^hCarrier^n            (Function)
  967.  
  968.      Purpose: Check if the carrier is high
  969.      Returns: 0=Carrier low, 1=Carrier high
  970.      Example: While Carrier=1
  971.               While carrier detect is high run the loop
  972.  
  973.     ^hCharsWaiting^n       (Function)
  974.  
  975.      Purpose: Get number of chars waiting in input buffer
  976.      Returns: 0-65535
  977.      Example: Print "Waiting characters ",CharsWaiting
  978.  
  979.     ^hCloseCom^n           (Command)
  980.  
  981.      Purpose: Close the current device
  982.      Syntax : CloseCom
  983.  
  984.     ^hClrLastIncoming^n    (Command)
  985.  
  986.      Purpose: Clear LastIncoming to 255 #0
  987.      Syntax : ClrLastIncoming
  988.  
  989.     ^hDeviceResult^n       (Variable)
  990.  
  991.      Purpose: The last result code from the device, 0=Ok
  992.      Returns: 0-65535
  993.      Example: Print "Device result ",DeviceResult
  994.  
  995.     ^hDeviceResultStr^n    (Function)
  996.  
  997.      Purpose: Return error text of the last result code from the device, 0=Ok
  998.      Syntax : DeviceResultStr(Resultcode)
  999.      Returns: String
  1000.      Example: Print "Device result ",DeviceResultStr(DeviceResult)
  1001.  
  1002.     ^hFlushInBuffer^n      (Command)
  1003.  
  1004.      Purpose: Flush the incoming device buffer
  1005.      Syntax : FlushInBuffer
  1006.  
  1007.     ^hGetBaud^n            (Function)
  1008.  
  1009.      Purpose: Get the current baud rate
  1010.      Returns: 0-115200
  1011.      Example: Print "Current baud ",GetBaud
  1012.  
  1013.     ^hGetChar^n            (Function)
  1014.  
  1015.      Purpose: Get a character from the device
  1016.      Returns: #0..#255
  1017.      Example: Print GetChar
  1018.  
  1019.     ^hGetCharTimeout^n     (Function)
  1020.  
  1021.      Purpose: Get a character from the device, timeout in tics
  1022.      Syntax : GetCharTimeout(number-of-tics)
  1023.      Example: Set Received=GetCharTimeout(91)
  1024.               Try to get a character from the device timeout in 5 seconds
  1025.      Notes  : A PC has 18.2 tics per second 5x18.2 = 91 tics = 5 seconds
  1026.  
  1027.     ^hGetData^n            (Function)
  1028.  
  1029.      Purpose: Get the current databits
  1030.      Returns: 7-8
  1031.      Example: Print "Current databits ",GetData
  1032.  
  1033.     ^hGetInterface^n       (Function)
  1034.  
  1035.      Purpose: Get the serial interface type in use
  1036.      Returns: 0=NoDevice, 1=UartDevice, 2=Int 14h, 3=Fossil, 4=Digiboard
  1037.      Example: Print "Active serial interface type ",GetInterface
  1038.  
  1039.     ^hGetParity^n          (Function)
  1040.  
  1041.      Purpose: Get the current parity in use
  1042.      Returns: N=None, O=Odd, E=Even, M=Mark, S=Space
  1043.      Example: Print "Current parity in use ",GetParity
  1044.  
  1045.     ^hGetPort^n            (Function)
  1046.  
  1047.      Purpose: Get the active port number
  1048.      Returns: 1-8
  1049.      Example: Print "Active port ",GetPort
  1050.  
  1051.     ^hGetStop^n            (Function)
  1052.  
  1053.      Purpose: Get the current stopbits
  1054.      Returns: 1-2
  1055.      Example: Print "Current stopbits ",GetStop
  1056.  
  1057.     ^hHangup^n             (Command)
  1058.  
  1059.      Purpose: Drop the carrier, using the hangup string or toggling DTR
  1060.      Syntax : Hangup
  1061.  
  1062.     ^hInitDevice^n         (Command)
  1063.  
  1064.      Purpose: Open one of the devices in Terminate
  1065.      Syntax : InitDevice devicenumber,port,baud
  1066.      Example: InitDevice 4,2,57600
  1067.               Open device 4, using port 2 with baud 57600
  1068.      Notes  : If another device is already open it will be closed.
  1069.  
  1070.     ^hInitDirect^n         (Command)
  1071.  
  1072.      Purpose: Open a device and initialise the communications port directly
  1073.      Syntax : InitDirect interface,port,baud,databits,stopbits,parity,
  1074.                          inbufsize,outbufsize,flowctrl
  1075.               Interface : 0=NoDevice, 1=UartDevice, 2=Int 14h,
  1076.                           3=Fossil, 4=Digiboard
  1077.               Port      : 1-8
  1078.               Databits  : 7-8
  1079.               Stopbits  : 1-2
  1080.               Parity    : N=None, O=Odd, E=Even, M=Mark, S=Space
  1081.               Inbufsize : 10-65000
  1082.               Outbufsize: 10-65000
  1083.               Flowctrl  : 0=None, 1=RTS/CTS, 2=XonXoff, 3=DSR/DTR
  1084.      Example: InitDirect 1,2,38400,8,1,"N",1024,1024,1
  1085.               Use Uart on COM2 with 38400,8N1 and 1024 bytes buffers
  1086.               for in/out. RTS/CTS flowcontrol
  1087.      Notes  : If another device is already open it will be closed.
  1088.  
  1089.     ^hLastIncoming^n       (Variable)
  1090.  
  1091.      Purpose: Holds the last 255 characters received by GetChar
  1092.      Returns: String
  1093.      Example: Print LastIncoming
  1094.  
  1095.     ^hSend^n               (Command)
  1096.  
  1097.      Purpose: Send a string to the device with modem delay.
  1098.      Syntax : Send expression
  1099.      Example: Send "ATA^M"
  1100.               Send the HAYES answering command to device
  1101.  
  1102.     ^hSendRaw^n            (Command)
  1103.  
  1104.      Purpose: Send a string to the device in raw format
  1105.      Syntax : SendRaw expression
  1106.      Example: Sendraw "----------------"
  1107.  
  1108.     ^hWaitFor^n            (Command)
  1109.  
  1110.      Purpose: Wait for a string from device
  1111.      Syntax : WaitFor expression,seconds
  1112.      Example: WaitFor "Enter name:",20
  1113.               If IOResult<>0
  1114.                 Goto Timeout
  1115.               Endif
  1116.      Notes  : IOResult=0 Got String, IOResult=2 Timeout
  1117.  
  1118.    ^hFile handling^n
  1119.  
  1120.     All file commands will give the result code in IOResult.
  1121.  
  1122.     ^hIOResult^n           (Variable)
  1123.  
  1124.      Purpose: Result of the last file operation
  1125.      Returns: 0-65535, 0=Ok
  1126.      Example: Print IOResult
  1127.  
  1128.     PRS supports two kind of files. Binary files and text files. Binary
  1129.     files are data files like TERMINAT.EXE which contain characters from
  1130.     #0..#255. Text files like AUTOEXEC.BAT are line based and easier to
  1131.     use.
  1132.  
  1133.       PRS allows you to have 8 open files at the same time. 4 binary files
  1134.       and 4 text files.
  1135.  
  1136.     ^hText files^n
  1137.  
  1138.      Textfiles are easier to understand when you see the following example:
  1139.  
  1140.       OpenText 1,"C:\AUTOEXEC.BAT",0
  1141.       While EndofTextFile(1)=0
  1142.         PrintLn readtext(1)
  1143.       EndWhile
  1144.       CloseText 1
  1145.  
  1146.      This will open a text file and print the entire file on your screen.
  1147.  
  1148.      ^hCloseText^n         (Command)
  1149.  
  1150.       Purpose: Close a text file
  1151.       Syntax : CloseText handle
  1152.       Example: CloseText 1
  1153.  
  1154.      ^hEndOfTextFile^n     (Function)
  1155.  
  1156.       Purpose: Tells you if we are on the last line in the file
  1157.       Syntax : EndofTextFile(handle)
  1158.       Returns: 0=No, 1=Yes, end-of-file
  1159.       Example: While EndofTextFile(1)=0
  1160.                Continue until end-of-file
  1161.  
  1162.      ^hOpenText^n          (Command)
  1163.  
  1164.       Purpose: Opens a text file for reading, writing or appending.
  1165.       Syntax : OpenText handle,filename,mode
  1166.                handle  : 1-4
  1167.                filename: Full pathname of file
  1168.                mode    : 0=Read, 1=Write, 2=Append
  1169.       Example: OpenText 1,"C:\AUTOEXEC.BAT",0
  1170.                Opens text file 1 for reading.
  1171.  
  1172.      ^hPosText^n           (Function)
  1173.  
  1174.       Purpose: Report the byte position in a text file.
  1175.       Syntax : PosText(handle)
  1176.       Example: Print "Position ",PosText(1)
  1177.                Show the byte-position on text file 1
  1178.  
  1179.      ^hReadText^n          (Function)
  1180.  
  1181.       Purpose: Read 1 line from a text file
  1182.       Syntax : ReadText(handle)
  1183.       Returns: String
  1184.       Example: PrintLn ReadText(1)
  1185.                Reads and displays one line from text file 1
  1186.  
  1187.      ^hSeekText^n          (Command)
  1188.  
  1189.       Purpose: Seek to a file position in a text file.
  1190.       Syntax : SeekText handle,position
  1191.                Position is the byte-position in file 0=First byte
  1192.       Example: SeekText 1,1000
  1193.                Seeks to position 1000 in the file
  1194.  
  1195.      ^hSizeText^n          (Function)
  1196.  
  1197.       Purpose: Report the size in bytes on a text file
  1198.       Syntax : SizeText(handle)
  1199.       Returns: filesize-in-bytes
  1200.       Example: Print SizeText(handle)
  1201.  
  1202.      ^hWriteLnText^n       (Command)
  1203.  
  1204.       Purpose: Write a string to a text file
  1205.       Syntax : WriteLnText handle,string
  1206.       Example: WriteLnText 1,OutString
  1207.                Writes the contents of OutString to text file 1
  1208.  
  1209.      ^hWriteText^n         (Command)
  1210.  
  1211.       Purpose: Write a string to a text file without CR+LF
  1212.       Syntax : WriteText handle,string
  1213.       Example: WriteText 1,OutString
  1214.                Writes the contents of OutString to text file 1
  1215.  
  1216.     ^hBinary files^n
  1217.  
  1218.      ^hClose^n             (Command)
  1219.  
  1220.       Purpose: Close a file
  1221.       Syntax : Close handle
  1222.       Example: Close 1
  1223.  
  1224.      ^hEof^n               (Function)
  1225.  
  1226.       Purpose: Tells you if we are on the last position in the binary file
  1227.       Syntax : EndofTextFile(handle)
  1228.       Returns: 0=No, 1=Yes, end-of-file
  1229.       Example: While Eof(1)=0
  1230.                Continue until end-of-file
  1231.  
  1232.      ^hFilePos^n           (Function)
  1233.  
  1234.       Purpose: Report the byte position in a binary file.
  1235.       Syntax : FilePos(handle)
  1236.       Example: Print "Position ",FilePos(1)
  1237.                Show the byte-position on binary file 1
  1238.  
  1239.      ^hFileSize^n          (Function)
  1240.  
  1241.       Purpose: Report the size in bytes on a binary file
  1242.       Syntax : FileSize(handle)
  1243.       Returns: filesize-in-bytes
  1244.       Example: Print FileSize(handle)
  1245.  
  1246.      ^hOpen^n              (Command)
  1247.  
  1248.       Purpose: Opens a binary file for reading, writing or both.
  1249.       Syntax : Open handle,filename,mode,filemode
  1250.                handle  : 1-4
  1251.                filename: Full pathname of file
  1252.                mode    : 0=Read, 1=Write, 2=Append
  1253.                filemode: 0=ReadOnly,1=WriteOnly,2=ReadWrite,+64=DenyNone
  1254.       Example: Open 1,"TERMINAT.CFG",0,0
  1255.                Opens binary file 1 for reading.
  1256.  
  1257.      ^hRead^n              (Function)
  1258.  
  1259.       Purpose: Reads a number of characters from a binary file
  1260.       Syntax : Read(handle,numbytes)
  1261.       Returns: String
  1262.       Example: Set FileGrab=Read(1,20)
  1263.                Read 20 characters into FileGrab
  1264.  
  1265.      ^hSeek^n              (Command)
  1266.  
  1267.       Purpose: Seek to a file position in a binary file.
  1268.       Syntax : Seek handle,position
  1269.                Position is the byte-position in file 0=First byte
  1270.       Example: Seek 1,1000
  1271.                Seeks to position 1000 in the file
  1272.  
  1273.      ^hWrite^n             (Command)
  1274.  
  1275.       Purpose: Write a number of characters to a binary file
  1276.       Syntax : Write(1,expression)
  1277.       Example: Write(1,"HELLO")
  1278.  
  1279.    ^hDOS commands^n
  1280.  
  1281.      The result of each call is stored in IOResult
  1282.  
  1283.     ^hDeleteFile^n         (Command)
  1284.  
  1285.      Purpose: Deletes a file
  1286.      Syntax : DeleteFile filename
  1287.      Example: DeleteFile "TERMINAT.BAK"
  1288.  
  1289.     ^hExec^n               (Command)
  1290.  
  1291.      Purpose: Call a DOS command
  1292.      Syntax : Exec expression
  1293.      Example: Exec "TERMAIL\TM.EXE !M"
  1294.               Call the TerMail program
  1295.      Notes  : All the !-commands described other places in the manual
  1296.               can be used here. !M=Swap out memory
  1297.  
  1298.     ^hFindFirst^n          (Function)
  1299.  
  1300.      Purpose: Finds a file allowing wildcards
  1301.      Syntax : FindFirst(expression,attribute)
  1302.               Attribute: 1=ReadOnly, 2=Hidden, 4=System, 8=VolumeID,
  1303.                          16=Directory, 32=Archive, 63=AnyFile
  1304.      Returns: Filename only or blank if no mathces
  1305.      Example: Print FindFirst("C:\*.*",32)
  1306.  
  1307.     ^hFindNext^n           (Command)
  1308.  
  1309.      Purpose: Find next match after a FindFirst use
  1310.      Returns: Filename found
  1311.      Example: PrintLn FindFirst("C:\*.*",32)
  1312.               While IOResult=0
  1313.                 PrintLn FindNext
  1314.               EndWhile
  1315.               Will display to entire root of your C-drive
  1316.  
  1317.     ^hFindNextSize^n       (Variable)
  1318.  
  1319.      Purpose: Returns filesize of last FindNext
  1320.      Returns: Size in bytes
  1321.      Example: PrintLn FindNextSize
  1322.  
  1323.     ^hFindNextAttr^n       (Variable)
  1324.  
  1325.      Purpose: Returns file attribute of last FindNext
  1326.      Returns: Byte
  1327.      Example: PrintLn FindNextAttr
  1328.  
  1329.     ^hFindNextTime^n       (Variable)
  1330.  
  1331.      Purpose: Returns filetime of last FindNext
  1332.      Returns: Time in unix number
  1333.      Example: PrintLn FindNextTime
  1334.  
  1335.     ^hRename^n             (Command)
  1336.  
  1337.      Purpose: Rename a file to another name
  1338.      Syntax : Rename filename new-filename
  1339.      Example: Rename "TEST.TXT","TEST2.TXT"
  1340.               Renames TEST.TXT -> TEST2.TXT
  1341.  
  1342.    ^hDate, time handling^n
  1343.  
  1344.     ^hGetDate^n            (Variable)
  1345.  
  1346.      Purpose: Returns date in formatted form
  1347.      Returns: Date-string DD-Mmm-YYYY (Day, Month-string, Year)
  1348.      Example: PrintLn GetDate
  1349.               Print todays date: 7-Aug-1995,  21-Jan-96
  1350.  
  1351.     ^hGetDateRaw^n         (Variable)
  1352.  
  1353.      Purpose: Returns date in raw form
  1354.      Returns: String YYYY MM DD DOW   (Year, Month, Day, Day-of-week)
  1355.      Example: PrintLn GetDateRaw
  1356.               Print current date: 1995 08 07 01
  1357.  
  1358.     ^hGetTime^n            (Variable)
  1359.  
  1360.      Purpose: Returns time in formatted form
  1361.      Returns: Time-string HH:MM:SS
  1362.      Example: PrintLn GetTime
  1363.               Print current time: 18:39:25
  1364.  
  1365.     ^hResetTimer^n         (Command)
  1366.  
  1367.      Purpose: Resets timer 1-4
  1368.      Syntax : ResetTimer timer-num,seconds
  1369.      Example: ResetTimer 1,60
  1370.               Sets timer to expire after 60 seconds
  1371.  
  1372.     ^hTimeElapsed^n        (Function)
  1373.  
  1374.      Purpose: Returns in milliseconds time elapsed since ResetTimer
  1375.      Syntax : TimeElapsed(timer-num)
  1376.      Returns: Milliseconds elapsed
  1377.      Example: PrintLn TimeElapsed(1)
  1378.  
  1379.     ^hTimerExpired^n       (Function)
  1380.  
  1381.      Purpose: Check if a timer has expired.
  1382.      Syntax : TimerExpired(timer-num)
  1383.      Returns: 0=No, 1=Timer expired
  1384.      Example: Until TimerExpired(1)=1
  1385.  
  1386.     ^hWait^n               (Command)
  1387.  
  1388.      Purpose: Pause in 1/100 seconds
  1389.      Syntax : Wait num-1/100-seconds
  1390.      Example: Wait 200
  1391.               Wait 2 seconds before continuing
  1392.  
  1393.    ^hFile transfers^n
  1394.  
  1395.      One of the most common tasks you will need the scripts for is to
  1396.      transfer files to/from another system. To do this you need to
  1397.      use the internal or external protocols specified below.
  1398.  
  1399.       Protocols
  1400.  
  1401.            1 + Zmodem                 + = Batch protocol
  1402.            2 + ZedZap
  1403.            3   Ascii
  1404.            4   Xmodem
  1405.            5   Xmodem-1K
  1406.            6   Xmodem-1K-G
  1407.            7 + Ymodem
  1408.            8 + Ymodem-G
  1409.            9 + Kermit
  1410.           10 + CompuServe B+
  1411.       11..22 ? External protocols
  1412.  
  1413.     ^hDownload^n           (Command)
  1414.  
  1415.      Purpose: Receive files from another system
  1416.      Syntax : Download protocol,filename
  1417.      Example: Download 1
  1418.               Download 3,"CAPTURE.TXT"
  1419.      Notes  : All protocols that are not batch must have a filename
  1420.  
  1421.     ^hUpload^n             (Command)
  1422.  
  1423.      Purpose: Send files to another system
  1424.      Syntax : Upload protocol,filename(s)/wildcards
  1425.      Example: Upload 1,"C:\TERMINAT\UPLOAD\DANBBS.QWK"
  1426.               Upload 3,"C:\TERMINAT\UPLOAD\*.* C:\TERMINAT\DOCS\*.DOC"
  1427.  
  1428.    ^hEmulations^n
  1429.  
  1430.     ^hSetTerminal^n        (Command)
  1431.  
  1432.      Purpose: Change to terminal slot
  1433.      Syntax : SetTerminal slot
  1434.      Example: SetTerminal 1
  1435.               ANSI-BBS is now the current terminal
  1436.  
  1437.     ^hWriteTerminal^n      (Command)
  1438.  
  1439.      Purpose: Send a string to terminal emulation
  1440.      Syntax : WriteTerminal expression
  1441.      Example: If CharsWaiting<>0
  1442.                 WriteTerminal GetChar
  1443.               Endif
  1444.               Displays received character from device
  1445.  
  1446.    ^hTerminate control^n
  1447.  
  1448.     ^hDial^n               (Command)
  1449.  
  1450.      Purpose: Dial number in the phonebook
  1451.      Syntax : Dial numbers,numbers,numbers.....
  1452.      Example: Dial 1,2,3,4
  1453.               Dial 27
  1454.      Notes  : IOResult=0 No connect, IOResult=1 Connection
  1455.  
  1456.     ^hGetUserName^n        (Function)
  1457.  
  1458.      Purpose: Get username from phonebook record
  1459.      Syntax : GetUserName
  1460.      Returns: String
  1461.      Example: Send GetUserName
  1462.               Send username to device
  1463.  
  1464.     ^hGetUserPassword^n    (Function)
  1465.  
  1466.      Purpose: Get password from phonebook record or default
  1467.      Syntax : GetUserPassword
  1468.      Returns: String
  1469.      Example: Send GetUserPassword
  1470.               Send password to device
  1471.  
  1472.     ^hMainLoop^n           (Command)
  1473.  
  1474.      Purpose: Run Terminate main loop
  1475.      Syntax : MainLoop times
  1476.      Example: MainLoop 10
  1477.               Allow the script to access all the Terminate functions
  1478.  
  1479.    ^hDirect hardware control^n
  1480.  
  1481.     Direct memory commands can be dangerous since it can access your
  1482.     hardware directly or indirectly. Please do not use any memory
  1483.     commands if you are the slightest bit insecure on their use.
  1484.  
  1485.     ^hFreeMem^n            (Function)
  1486.  
  1487.      Purpose: How much memory is left
  1488.      Returns: Number of bytes available for script language
  1489.      Example: Print FreeMem
  1490.               Displays free memory on screen
  1491.  
  1492.     ^hInterrupt^n          (Function)
  1493.  
  1494.      Purpose: Call any interrupt with register value *WARNING DANGEROUS*
  1495.      Syntax : Interrupt(interrupt-number,ax,bx,cx,dx,si,di,ds,es)
  1496.      Returns: String: ah al bh bl ch cl dh dl si di ds es flags
  1497.      Example: Print "Videomode:",GrabWord(Interrupt(16,3840,0,0,0,0,0,0,0),2)
  1498.               Get videomode in word 2 in string
  1499.      Notes  : Be very careful with command. It gives you access to the
  1500.               complete PC and therefore one wrong call can result in the
  1501.               worst errors. If you are not an expirenced programmer do not
  1502.               under any circumstances use this command.
  1503.  
  1504.     ^hMem^n                (Function)
  1505.  
  1506.      Purpose: Get a byte directly from memory location
  1507.      Syntax : Mem(segment,offset)
  1508.      Returns: 0-255
  1509.      Example: Print "Memory 0:0",Mem(0,0)
  1510.  
  1511.     ^hPortIn^n             (Function)
  1512.  
  1513.      Purpose: Get a byte directly from a hardware port
  1514.      Syntax : PortIn(port)
  1515.      Example: You will know if you need it!
  1516.  
  1517.     ^hPortOut^n            (Command)
  1518.  
  1519.      Purpose: Send a byte to a hardware port
  1520.      Syntax : PortOut port,byte
  1521.      Example: You will know if you need it!
  1522.  
  1523.     ^hPutMem^n             (Command)
  1524.  
  1525.      Purpose: Put a byte directly to memory location
  1526.      Syntax : PutMem byte,segment,offset
  1527.      Example: PutMem 65,47104,0
  1528.      Notes  : BE CAREFULL!
  1529.  
  1530.    ^hFax commands^n
  1531.  
  1532.     ^hSendFax^n            (Command)
  1533.  
  1534.      Purpose: Send a fax to a specific telephone number
  1535.      Syntax : SendFax filename,number,[to-name,subject]
  1536.      Example: SendFax "DOCS\PROBLEM.DOC","43627178","Sysop","Problem"
  1537.               SendFax "C:\AUTOEXEC.BAT","43627178"
  1538.      Notes  : Text, TIFF or PCX files will be converted to APF format first
  1539.               Note that the default fax settings and cover page will be used.
  1540.  
  1541.    ^hNumeric conversion^n
  1542.  
  1543.     ^hBinary^n             (Function)
  1544.  
  1545.      Purpose: Returns an binary string
  1546.      Syntax : Binary(Integer,bits)
  1547.      Example: PrintLn Binary(255,8)
  1548.               PrintLn Binary(256,16)
  1549.  
  1550.     ^hBinToInt^n           (Function)
  1551.  
  1552.      Purpose: Returns an integer from a binary string
  1553.      Syntax : BinToInt(string)
  1554.      Example: PrintLn BinToInt("11111111")
  1555.  
  1556.     ^hByteToHex^n          (Function)
  1557.  
  1558.      Purpose: Returns a string with hex value of byte 8-bit
  1559.      Syntax : ByteToHex(Byte)
  1560.      Example: PrintLn ByteToHex(255)
  1561.  
  1562.     ^hHexToInteger^n       (Function)
  1563.  
  1564.      Purpose: Returns an integer converted from a hex-string
  1565.      Syntax : HexToInteger(String)
  1566.      Example: PrintLn HexToInteger("FFFF")
  1567.  
  1568.     ^hLongToHex^n          (Function)
  1569.  
  1570.      Purpose: Returns a string with hex value of a double word 32-bit
  1571.      Syntax : LongToHex(Byte)
  1572.      Example: PrintLn LongToHex(255)
  1573.  
  1574.     ^hWordToHex^n          (Function)
  1575.  
  1576.      Purpose: Returns a string with hex value of word 16-bit
  1577.      Syntax : WordToHex(Byte)
  1578.      Example: PrintLn WordToHex(65000)
  1579.  
  1580.    ^hOther commands^n
  1581.  
  1582.     ^hExitTerminate^n      (Command)
  1583.  
  1584.      Purpose: Exit the script and Terminate with errorlevel
  1585.      Syntax : ExitTerminal [errorlevel]
  1586.      Example: ExitTerminate 100   (Errorlevel 100)
  1587.               ExitTerminate       (Errorlevel 1)
  1588.  
  1589.     ^hGetCrc^n             (Function)
  1590.  
  1591.      Purpose: Update a Crc-16 checksum
  1592.      Syntax : GetCrc(Byte,Old-Crc)
  1593.      Example: Set Crc=GetCrc(X,Crc)
  1594.  
  1595.     ^hGetCrcLong^n         (Function)
  1596.  
  1597.      Purpose: Update a Crc-32 checksum
  1598.      Syntax : GetCrcLong(Byte,Old-Crc)
  1599.      Example: Set Crc=GetCrcLong(X,Crc)
  1600.  
  1601.     ^hRandom^n             (Function)
  1602.  
  1603.      Purpose: Get a random number between 0-65535
  1604.      Syntax : Random(max)
  1605.      Example: Print Random(100)
  1606.               Displays a random number between 0-99
  1607.  
  1608.     ^hRandomize^n          (Command)
  1609.  
  1610.      Purpose: To initialise the random factor for the Random function
  1611.      Syntax : Randomize
  1612.  
  1613.     ^hCommentNum^n         (Function)
  1614.  
  1615.      Purpose: Get number of script comments
  1616.      Syntax : CommentNum(0)
  1617.      Example: Set Comments=CommentNum(0) <- Must be zero!
  1618.  
  1619.     ^hCommentStr^n         (Function)
  1620.  
  1621.      Purpose: Get script comments
  1622.      Syntax : CommentStr(Commentnumber)
  1623.      Example: PrintLn CommentStr(1)
  1624.  
  1625.     ^hTerminate^n          (Command)
  1626.  
  1627.      Purpose: Exit the script
  1628.      Syntax : Exit
  1629.  
  1630.