home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Club Amiga de Montreal - CAM
/
CAM_CD_1.iso
/
files
/
291.lha
/
Scripit_v1.20
/
Docs
/
Reference.DOC
< prev
next >
Wrap
Text File
|
1989-10-09
|
74KB
|
1,995 lines
Scripit 1.20 Command Reference
==============================
Introduction:
-------------
Scripit is a not a language in the normal sense of computer languages.
It is, instead, a script language that allows the user to automate
actions he/she would normally have to do manually. (although Scripit
goes far beyond that) Scripit can do anything the user can do manually
by either the mouse or keyboard by using a set of commands that instruct
Scripit to simulate specific mouse or keyboard actions.
The major concept in Scripit is that of a 'selected window.' As you
know, the Amiga's user interface consists of windows (which reside on
one or more screens.) These windows can be moved or resized, pushed to
the front or back, and are used to get user input via the keyboard or
mouse in the form of menu selections, boolean gadgets (clicks), string
gadgets (text input), proportional gadgets (slider moves), mouse movements,
mouse clicks, and keyboard actions. Scripit can simulate all of those
in order to automate actions.
The first step in any Scripit script is to select the 'selected window'
which may or may not be the currently active window. Once a window is
selected, all (well, actually most) Scripit commands will act upon that
window and will send simulated actions to it. This allows Scripit to
'drive' programs that are in the background while you are working on
something else.
Next, commands are issued in the script to do things to the selected
window. For example:
select window "MyProgram"
menu "MenuName" "MenuItem"
This script will select the window named "MyProgram" (this is the window
title displayed in its title bar) and will then simulate the user
selecting the menu "MenuName" item "MenuItem". The select window
command will search for the window title specified in all of the screens
in the Amiga's system at the time the script was run. There are several
select commands in Scripit that control how the window is selected.
Scripit will never allow the user to do something that the program
doesn't expect. For example, if a menu item was disabled (ghosted)
Scripit will not send the simulated menu selection. This is a safety
feature that makes it more reliable since the program that disabled
the menu item probably did it for a very good reason.
Menu selections are just a drop in the ocean of what Scripit can do,
but this should give you a taste of its power. Scripit can also output
text and graphics onto the selected window (without the program owning
the window even knowing what is happening) or output text to a console
(a text-based window) that it was run from or it has opened using
special Scripit console control commands.
The easiest way of starting with Scripit is to use the provided
'Recorder' to record user actions as a script that can be executed
again to repeat those actions. The generated script is a valid Scripit
script and can be edited and modified. However, the Recorder does not
use any of the more powerful Scripit facilities such as variables,
graphics and text output, console control, or logic flow commands (such
as if/else, while, goto, etc.)
Scripit can also be driven from ARexx allowing ARexx control over programs
that do not have ARexx ports... but that is a different story entirely.
----------------------------------------------------------------------------
The following is the full reference to all Scripit commands.
----------------------------------------------------------------------------
Scripit Select Commands
=======================
The SELECT commands are used to select the window Scripit will work with.
For example, 'SELECT WINDOW Test' will tell Scripit to select the
window titled 'Test' (actually the first window starting with 'Test')
for further control.
Normally, if no SELECT command was issued, the first command that
tries to do anything to a window will automatically select the currently
active window. If you issued a SELECT command and it couldn't find
the window you requested, it will continue from there without
aborting. So, the next command will select the active window automatically.
The SELECT WAIT command controls the operation of all the SELECT commands.
If you issue a 'SELECT WAIT 1000' command, all the SELECT commands
afterwards will wait for 1000 jiffies (i.e. 1000/50 = 20 seconds) before
failing and continuing with the script. (Scripit will check for the window
once every 10 jiffies.)
Also, if you specify the 'ABORT' keyword in the SELECT WAIT command, e.g.
'SELECT WAIT 1000 ABORT' all the SELECT commands will wait for the specified
time, but will abort the script if the time runs out and Scripit couldn't
find the requested window yet. So, the SELECT WAIT command actually
controls the operation of the 'SELECT WINDOW Test' command.
There are cases when the window you are trying to select has no title. In
that case, you can use one of the other SELECT commands for that. They are:
SELECT SCREEN, which selects the first window in the specified screen.
SELECT MENU, which selects the window by the name of one of its menus.
SELECT GADGET, which selects the window by the name of one of its gadgets.
SELECT ACTIVE, which selects the active window.
Command Summary:
----------------
SELECT screenname windowname
Select the Screen (and window) all the other commands will work
on. If no SELECT command was used, the currently active window
will be selected. (In all cases, the first match will be used.)
S SCREEN screenname
Select the first window in the specified screen.
S WINDOW windowname
Select the specified window. (Searches through all the screens
in the system.)
S ACTIVE Select the currently active window.
S MENU menuname
This will force the screen/window search to look for the
specified menu as the search criterion for the SELECT command.
This should only be used with programs that have no screen or
window name. (e.g. to select DPaint: SELECT MENU Picture)
Make sure you select a menu name that is unique to the program
you're looking for.
S GADGET gadgetname
This will force the screen/window search to look for the
specified gadget name as the search criterion for the SELECT
command. This should be used only when the program has no
no screen or window name, or any menus. Make sure you select
a gadget name unique to the window you're looking for.
S WAIT [MaxDelay] [ABORT]
This sets the time all the SELECT commands will keep trying
to find the requested screen, window, menu, or gadget. The
MaxDelay is specified in ticks, (50 per second). The ABORT
keyword, when specified, tells Scripit to abort the script if
the requested window, etc. could not be found in the specified
time, otherwise, if the ABORT keyword was not specified, the
script will just continue. Example: SELECT WAIT 500 ABORT
This means: Wait for 10 seconds (500/50) and if nothing found
then abort the script. The S WAIT command doesn't do anything
by itself, it only modifies the operation of the other SELECT
commands (except for SELECT ACTIVE.)
To turn the wait off, just type 'S WAIT' alone.
Return Codes:
-------------
All select commands (except SELECT WAIT) will fill in #result
with 1 for success or 0 for failure. If #result is true, then
#result2 will have the actual window's address, and #result3
will have the actual screen's address. $window will contain
the window's title and $screen will contain the screen's title.
Note: In all SELECT commands, SELECT can be replaced with an 'S'.
----- e.g. 'S ACTIVE' is the same as 'SELECT ACTIVE'.
----------------------------------------------------------------------------
Main Commands
=============
The following commands mostly simulate user actions. (i.e. menus, gadgets,
mousemoves, keyboard keys, etc.)
MENU menu menuitem <subitem>
Simulate a menu selection from the selected window's menu. The
input is 'menu' 'menuitem' and if needed 'subitem'. This
command needs at least the first two to work. Note 1 explains
naming conventions. (If the window has the MENUVERIFY flag set
Scripit will send a MENUVERIFY msg and wait for a reply to it
before sending the actual menu select message.)
Return Codes:
#result : 1 for success, 0 for failure.
$result : Menu name
$result2 : Item name
$result3 : Subitem name (if exists)
if #result == 0, then:
#result2 : 0 for menu not found, 10 for menu disabled.
GADGET gadgetname ID NUM X Y
This controls the gadgets of the selected window. It needs a
gadgetname (or number) to identify the gadget and, depending
on the gadget type needs more arguments to modify that
gadget's contents. It will send both a GadgetUp and a
GadgetDown message if the window's flags request that.
(See Note 3 for more info.)
Return Codes:
-------------
ALL gadget commands (GADGET, GADGETDOWN, GADGETUP & GETGADGET)
fill in the following return codes:
$result : full text name of gadget (if exists)
#result : 0 = failure (gadget not found), 1 = bool gadget,
2 = prop gadget, 3 = string gadget
if #result == 1 : (bool gadget)
#result2 : 0 = gadget not selected, 1 = gadget selected
if #result == 2 : (prop gadget)
#result2 : prop gadget horizontal position (0-65536)
#result3 : prop gadget vertical position (0-65536)
if #result == 3 : (string gadget)
$result2 : current contents of string gadget
$result3 : contents of string gadget undo buffer
GADGET boolgadgetname ID NUM X Y
Triggers a selected bool gadget from the selected window.
GADGET stringgadgetname ID NUM X Y newstring
Replaces the string in a string gadget with a new string and
simulates a 'return' on the gadget. [opt1] is the new string.
GADGET propgadgetname ID NUM X Y horz,vert
Changes the position of a proportional gadget. The input values
reflect the horizontal and vertical prop position of the gadget.
(Values allowed: 0-65535) [horz] is the horizontal position,
and [vert] is the vertical position.
GADGETDOWN Does the same job as 'GADGET' except that it will only send
GadgetDown messages and not GadgetUp messages.
(For use with Recorder scripts.)
GADGETUP Does the same job as 'GADGET' except that it will only send
GadgetUp messages and not GadgetDown messages.
(For use with Recorder scripts.)
GETGADGET gadgetname ID NUM
This is identical to the GADGET command, except that it doesn't
actually trigger or do anything to the gadget. It will just
check the gadget's status and fill in the corresponding result
variables as per the GADGET command's return results.
WAIT <delay>
Suspends script execution for delay * 1/50th seconds. Default
delay time is 25, i.e. 1/2 second.
LMB x,y
Simulate clicking the left mouse button while the pointer
is at position x,y.
Related : SELECTUP Sends only LMBUp message.
Commands : SELECTDOWN Sends only LMBDown message.
RMB x,y
Simulate clicking the right mouse button while the pointer
is at position x,y.
Related : MENUUP Sends only RMBUp message.
Commands : MENUDOWN Sends only RMBDown message.
DOUBLECLICK Simulate a double click. This can be one of the following:
DOUBLECLICK GADGET boolgadget
DOUBLECLICK RMB
DOUBLECLICK LMB
The delay between the two clicks is controlled by the double-
click setting in Preferences.
VERBOSE [ON] or [FULL] or [OFF]
Turns on debug text printout to the console window. Default
mode is off. VERBOSE ON will turn it on, any keyword other
than 'ON' will turn it off except VERBOSE FULL which will turn
on full debug display.
DRAG x,y,x2,y2,[steps]
This is intended for use with WorkBench. It will click on an
icon at x,y (if it exists) and will keep holding down the button
while moving the icon to x2,y2 where it will release the button.
It is the equivalent of:
(RMBDOWN x,y + MOUSEMOVE x2,y2 + RMBUP x2,y2).
Steps, if specified, will make the drag into an actual drag by
inserting interim MOUSEMOVE commands between the RMBDOWN and
RMBUP. The number of interim moves is the number of steps
specified.
MOUSEMOVE x,y
Simulates mouse movement to x,y. (Sends a MOUSEMOVE message.)
DELTAMOVE x,y
Simulate mouse movement by x,y. (Sends a DELTAMOVE message.)
RAWKEY code,qualifier
Sends a RAWKEY event to the program owning the selected window.
This command is only intended for script generated by the auto-
script generator, Recorder.
ITICK x,y
Sends an INTUITICKS event to the program. This is only intended
for scripts generated by the Recorder.
POINTER x,y [l] [L] [r] [R]
Pointer will move the mouse pointer to position x,y on the
current screen. This will _really_ move the pointer not just
simulate it. The qualifier (one of the following l,L,r,R)
simulates left mouse button down, left mouse button up, right
mouse button down, right mouse button up.
DRAW x,y x2,y2 x3,y3 ..... xn,yn
A specialized command used for drawing on DeluxePaint's screen.
It simulates the following:
POINTER x,y l
POINTER x2,y2 L
POINTER x2,y2 l
POINTER x2,y2 L
....
POINTER xn,yn l
POINTER xn,yn L
WAITFOR screen window <maxdelay> [ABORT]
This command is obsolete. You should use the SELECT WAIT
command instead. This was left in here for compatibility
with older scripts only.
RUN <program>
Simply runs another program. Control returns immediately to the
script which continues executing. If you want to include any
command line switches, then RUN "programname switches.."
Read note 4.
RUNBACK <program>
Simply runs another program. Control returns immediately to the
script which continues executing. The program will not have any
input or output streams. Read note 4.
EXECUTE <program>
Executes another program. Script processing will wait until the
program exits. You can also use the shorthand version of this
command: 'X'. (e.g. X list) Read note 4.
REQUEST [requester title] [default dir] [default file] [left edge]
[top edge] [req width] [req height]
This brings up the Scripit file requester and allows the user to
select a file. The return value of the requester is stored in
system variable $request. (see 'System Variables') The
arguments provided to REQUEST are not necessary, but they
override the defaults. The requester's title is "Please Select
A File:" unless you supply one. The default dir and default
file are whatever was in the File Requester the last time it was
run. The left edge, top edge, width and height control the size
and placement of the requester when it comes up. (The requester
itself is totally resizable and moveable by the user.) If none
of those was specified, the requester will come up where it was
the last time it was used.
NOTE: The requester will always show up on the selected screen!
(or on the Workbench screen if none was selected.)
Important: This function is not available in 'Xit' only in
the 'Scripit' program itself.
ABORT [ON] or [PAUSE] or [OFF]
ABORT controls whether the abort and pause/restart facilities
work or not. ABORT OFF disables both the abort and the pause/
restart facilities. ABORT PAUSE only allows the pause/restart
but not the abort facility. And ABORT ON, which is the default
mode, allows both.
Abort facility: You can break out of a script that is currently
executing by holding down both the left mouse button and the
control key on the keyboard.
Pause/restart facility: You can stop the execution of a script
at any time by pressing the left mouse button and the left shift
key at the same time. To resume the script press the left mouse
button and then right shift key. (you can also use the abort
facility even when a script is paused.)
FORMAT formatstring arg1 arg2 ... argn
FORMAT is a text formatting function that does the same function
that sprintf() does in the C language. It uses the same format
as sprintf(). The following is the full explanation of it:
The formatting result string is stored in $result.
The format string contains two types of items: normal text
characters and 'coversion specifications', each of which causes
the conversion and output of the next successive argument.
The conversion specification always starts with a % and
continues with some optional characters, then the conversion
type characters, which can be any of the following: d, o, x,
u, c, or s.
For example:
$name = "Khalid Aldoseri"
#age = 24
FORMAT "Name : %s Age : %d" $name #age
After this, $result will contain:
"Name : Khalid Aldoseri Age : 24"
Conversion Characters:
----------------------
d, o, or x The integer in the corresponding argument is
converted to decimal, octal, or hexadecimal
notation, respectively, and output to the
result string.
u Converts an unsigned integer.
c Converts the integer to a single character
based on the standard ASCII tables.
s The characters in the corresponding argument
are output.
Optional specifications:
------------------------
These come in between the % and the conversion character.
a. An optional minus sign (-) which specifies left adjustment of
the converted integer or string.
b. An optional digit string specifying the 'field width' for the
conversion. If the resulting string has fewer characters
than this, enough blank characters are output to make the
total number of characters output equal the field width.
If the field width digits have a leading 0, 0 is used as a
pad character rather than a blank. The minus sign controls
whether the blanks are output before or after the string.
For example:
FORMAT "Hex: %08x Decimal: %8d" 10 10
Then, $result will contain "Hex: 0000000a Decimal: 10"
PRINTF formatstring arg1 arg2 ... argn
PRINTF does exactly the same job as FORMAT, except that it will
print out the result string to the current console. The result
will still be available in $result. PRINTF also allows for the
special character codes as listed in the next command.
PRINT arg1 arg2 ... argn
Prints out the strings provided to the current console. The
is not terminated after each string. You can also use any of
the following special codes in the strings:
\n Return + Line feed
\e Return (no line feed)
\r Same as \e
\t Tab
\b Backspace
E.g.: PRINT "Test\n"
These codes are only translated into actual returns, etc. when
the string is about to be printed, so if you store such codes in
a string variable, the code is stored, not the actual ASCII
character. These codes are also supported by the PRINTF,
CON ECHO, and CON TEXT commands.
Note 1: Argument format for Screen, Window, Menu and Gadget Selection:
-------
The required item can be selected by specifying:
a. The item's name. This is NOT case-sensitive. Abbreviations
are allowed. (i.e. 'Pro' will match the first item that
starts with 'Pro' e.g. 'Project'.)
Leading spaces are ignored.
b. The item's number. This is the sequential number of the
item in its list. This must always start with '^' and a
number. (e.g. 'MENU ^1 ^4 ^3' will select the first menu,
the fourth menuitem, and the 3rd subitem.)
Note 2: Arguments can be separated by one or more spaces, tabs, or a
------- comma. Any string argument can be surrounded with double-quotes
to include spaces in its text. (e.g. "Text string") All
numeric arguments are integer. (i.e. no fractions allowed) Any
argument can be substituted by a string or integer variable.
(Read section on 'Variables.')
Note 3: Gadgets are selected by one of the following methods:
-------
a. Gadget Name:
This is the text that is normally attached to a gadget. Few
programs attach text to gadgets. (Also use Lister for
gadget names.)
b. Gadget ID:
This is the gadget's ID number. Most programs have unique
ID numbers for each gadget. You can find out a gadget's ID
by using the 'Lister' program.
c. Serial Number:
This is just a serial number of the gadget. It is reliable
in some programs, and unreliable in others.
Scripit will search for the gadget based on the following logic:
1. Search for gadget name, first gadget that matches the name
will be selected. If no matching gadget found, or gadget
name was a null (""), then:
2. Search for ID. If found ID, then gadget found, unless more
than more gadget with the same ID was found.
3. As a last resort, scan for the gadget by its serial number.
Examples:
a. Bool Gadget:
GADGET "gadname" 323,6,10,34
This will search for "gadname" first, then ID 323, then #6. The
X (10) and Y (34) settings are fed into the message sent to the
program because some programs need to know where the pointer is
when the gadget was clicked on.
b. String Gadget:
GADGET "gadname" 323,6,10,34 "newstring"
c. Prop Gadget:
GADGET "gadname" 323,6,10,34 horz,vert
Note 4: The EXECUTE, RUN, and RUNBACK commands will interpret any
------- arguments added after the command and these arguments are
correctly passed to the command being executed/run.
For example:
RUN list df0:
To give null arguments to a program, just use "". e.g.:
X Lister "" workbench
Of course, any program name or argument that contains spaces or
commas needs to be in double quotes.
Note 5: The following commands return #result = 1 if successful, 0 if
------- failed: (success is if the message was delivered correctly to
the program.)
LMB, RMB, DOUBLECLICK, DRAG, MOUSEMOVE, DELTAMOVE, RAWKEY,
ITICK, POINTER, DRAW.
----------------------------------------------------------------------------
Scripit Graphics Commands
=========================
These commands draw directly on the specified window (i.e. into its
RastPort, if you understand what that means) The program owning the window
will not know if you changed the contents of the window.
To use those, just SELECT the window you want, and start drawing!
(Note: To select DPaint's window, use SELECT MENU PICTURE)
GFX PEN front_pen,back_pen,drawmode
This sets the current front pen, back pen, and draw mode.
The pen number can range from 0 to the number of colors on
the screen. The draw mode can be one of the following:
JAM1 (the background color, 0, does not overwrite what is
underneath it.) JAM2 (color 0 clears whatever is underneath
it.) COMP (the complement mode reverse the color of the
original pixel.) and INVR (which is the same as JAM2, only
with the front and back pen reversed.)
GFX MOVE x,y
Moves the windows 'cursor' to the specified x,y coords.
This affects where drawing will start.
GFX TEXT "string"
Prints the specified string in the current font to the
position selected by MOVE. (using the current front pen,
back pen, and drawing mode.)
GFX LINE x1,y1 x2,y2 .... xn,yn
Draws connected straight lines.
GFX CIRCLE x,y,radius
Draws a circle at x,y using the specified radius
GFX ELLIPSE x,y,x_radius,y_radius
Draws an ellipse at x,y using the specified x_radius and
y_radius.
GFX BOX x,y,x2,y2
Draws a rectangle. x,y and x2,y2 are any two opposite
corners.
GFX RECT x,y,x2,y2
Draws a filled-in rectangular. x,y and x2,y2 are any two
opposite corners.
GFX CLEAR x,y
Clears the current window. The x,y are optional and select
the start position for clearing.
GFX CLEARLINE x,y
Clear to the end of the current line starting at x,y.
GFX FILL x,y,fillmode
Does a flood-fill at the selected x,y using the current
front pen. Fillmode can be either 0 or 1.
(Note: This is currently not working very well, but I opted
to keep it in here.)
GFX PIXEL x,y
Draws a single pixel at x,y using the current frontpen and
drawmode.
GFX SAVEMODE modenumber
This saves the current settings (front pen, back pen, draw
mode, and current x,y) to a temporary storage. The
modenumber selects the storage slot number. (from 0 to 3)
You should always use the GFX SAVEMODE command before
changing anything in the window, and restore them using the
next command as soon as possible.
GFX RESTOREMODE modenumber
Restores the current settings to those stored in the
selected location. (0 to 3)
Example:
--------
select window "Workbench"
gfx savemode
gfx move 10,10
gfx pen 1,0,JAM2
gfx text "Some text on the Workbench Window!"
gfx restoremode
This script will select the Workbench window, save its current settings,
move the draw cursor to 10,10, set the front pen to 1, back pen to 0,
and draw mode to JAM2, then type some text there and finally restore the
window's settings to what they were.
----------------------------------------------------------------------------
Scripit Console Commands
========================
Scripit can output text to any text console using its console commands.
These allow both output of text and ANSI console control commands.
These Commands work with a CLI console only:
--------------------------------------------
CON CLS Clears all the text in the console and moves the cursor to the
top left-hand corner.
CON ECHO [string_1] [string_2] [string_3] ... [string_n]
Prints out the specified strings onto the console. Each string
is printed on its own line.
Please refer to the description of the PRINT command for more
details on print codes.
CON TEXT [string_1] [string_2] [string_3] ... [string_n]
Prints out the specified strings onto the console. The line is
not terminated after each string.
Note: To terminate a line use \n code E.g.
CON TEXT "test " $test "\n"
Please refer to the description of the PRINT command for more
details on print codes.
CON MOVE x,y
Moves the cursor to position x,y. If no x,y were given, the
cursor will be moved to the top left of the screen.
CON UP [n]
CON DOWN [n]
CON LEFT [n]
CON RIGHT [n]
Move the cursor up/down/left/right n times. (default is 1)
CON SCROLLUP [n]
CON SCROLLDOWN [n]
Scroll the console lines up/down n lines. (default is 1)
CON INSLINE
CON DELLINE
Insert/Delete a line at the current cursor position.
CON INSCHAR [n]
CON DELCHAR [n]
Insert/delete [n] chars at the current cursor position.
CON CURSORON
CON CURSOROFF
Turn cursor display on/off.
CON CLREOL Erase to end of line.
CON CLREOD Erase to end of display.
CON STYLE <style>;<frontpen>;<backpen>
This sets the style (bold, underline, italic, inverse) of the
text printed on the console as well as its front and back
colors. These match the same parameters used by ANSI for the
'Select Graphic Rendition' command.
The following is based on the Amiga RKM manual:
Any number of parameters can be passed to the CON STYLE
command in any order. They are separated by semi-colons.
These parameters are:
<style> 0 Plain text
1 Bold
2 Italic
4 Underline
7 Inverse-video
<frontpen> 30 to 37 Selects color 0 to 7 for foreground.
<backpen> 40 to 47 Selects color 0 to 7 for background.
For example: CON STYLE 1;2;33;45
This will set the console text to bold + italic
with a front pen of 3 and a back pen of 5.
(note: spaces are not allowed here.)
These parameters are cumulative. If you set bold then later set
italic, you will get bold/italic. To make sure that you get
only bold (or whatever) use a 0; to set plain text first. e.g.
CON STYLE 0;1 (clears previous modes, then sets bold.)
CON OPEN consolespec
This opens a new console that all the CON commands will use for
output. The format for the consolespec is the same as that for
opening a NewCLI console. i.e. "CON:10/15/450/195/Setup".
Note: If you open a console _all_ text output by Scripit will
be sent to that console, including debugging text.
If Scripit needs to output any text and it was run from
Workbench and you didn't open a console, then it will
automatically open a default console for you.
Results Codes:
#result will contain 1 if the console was opened, 0 if not.
CON CLOSE Closes the console opened by CON OPEN.
(console is automatically closed when Scripit quits.)
CON CSI <ANSI command>
This sends an ANSI command to the console. Scripit will insert
the CSI (Control Sequence Introducer) before the string and will
send the command untouched to the console. These codes can be
found in the Amiga RKM manuals or in the AmigaDOS manual.
Example:
--------
CON CLS
CON ECHO "This text is at the top of the screen."
CON MOVE 0,0
CON SCROLLDOWN 10
This will clear the console, type the text at the top of the console,
move the cursor back to the top, and scroll all lines down 10 times.
Note: In all CON commands, CON can be replaced with a 'C'.
----- e.g. 'C CLS' is the same as 'CON CLS'.
----------------------------------------------------------------------------
Controlling Workbench From Scripit
----------------------------------
Scripit can control Workbench using a special set of commands. To do this,
however, you must have 'XitLoadWB' running. XitLoadWB comes before LoadWB
in your startup sequence. It will watch over the loading of Workbench and
install hooks into Workbench that allow Scripit to find out the location
of icons on the Workbench screen.
(Note: XitLoadWB has only been tested with Workbench 1.3, I have no idea
whether it will continue to work as is with 1.4, or if it will need
modification.)
Installing 'XitLoadWB':
1. Copy the 'XitLoadWB' file to your C: directory.
2. Add a line 'XitLoadWB' in your s:startup-sequence right before the one
that says 'LoadWB'.
For example, this would be part of your startup-sequence:
....
XitLoadWB
LoadWB
....
Now, the next time you reboot, XitLoadWB will load and wait for LoadWB to
load Workbench. It will then install itself while Workbench is loading
and display a small message confirming that it is loaded and working.
What this program does is to hook itself to Workbench while it is loading,
and becomes an interface between Scripit and WB, receiving commands from
Scripit and telling Workbench what to do.
XitLoadWB will wait a maximum of 60 seconds for WB to load, otherwise it
will complain and abort.
With the Scripit WB commands, you do not need to 'SELECT' the Workbench
window, all WB commands will automatically do that, and will restore
the previously selected window.
The following is a list of the Scripit WB Commands:
Workbench Commands: For use with Workbench only
------------------------------------------------
WB SELECT <icon>
Selects (single-clicks) a Workbench icon.
(Will automatically deselect any icons previously selected.)
WB OPEN <icon>
Opens (double-clicks) a Workbench icon. This will open a
drawer's window, or invoke a tool or project.
(Will automatically deselect any icons previously selected.)
WB CLOSE <drawer>
Closes a Workbench drawer.
WB DESELECT Deselects all icons.
WB SHIFTSELECT <icon_1> <icon_2> ..... <icon_N>
Shift-selects a list of icons.
WB SHIFTOPEN <icon_1> <icon_2> ..... <icon_N>
Shift-selects a list of icons, and shift-double-clicks on
the last icon in the list.
WB SNAPSHOT This will 'Snapshot' the currently selected icons. Use
either the 'WB SELECT' command to select the icon, or the
'WB SHIFTSELECT' command to select multiple icons, then
issue this command.
WB CLEANUP This will 'Clean Up' the currently selected drawer.
WB REDRAW This will 'Redraw' the Workbench screen.
WB INFO This will bring up the 'Info' window about the select icon.
WB MENU <menu> <item>
Simulates selecting the specified menu/menuitem. e.g.
WB MENU Disk "Empty Trash" will trigger the Empty Trash
menu.
WB DRAG <icon> <move_x> <move_y> <steps>
Drags the WB icon by the specified x,y coordinates.
(x & y can be either positive or negative)
Specifying <steps> will make the drag smoother by showing
the icon actually moving. The number of steps is the number
of times the icon will be display on route. (I find that
20 to 30 steps are good for long moves.)
WB DRAGTO <icon> <destination_x> <destination_y> <steps>
Drags the WB icon to the specified x,y coordinates.
(x & y can only be positive.)
WB DRAGOVER <icon1> <icon2> <steps>
Drags icon1 and moves it on top of icon2. This will achieve
different results based on what icon1 and icon2 are.
(e.g. copy disk or move icon into drawer)
WB FIND <icon>
This will look for the specified icon on the Workbench
screen and fill in the appropriate result codes as specified
below.
Result Codes: All the WB commands will return a result code in #result.
------------- 1 if found icon, 0 if not. If #result == 1, then #result2
will contain the X position of the icon, and #result3 will
contain the Y position. (these are actually the center
point of the icon, not its left/top edges.) $result will
contain the actual name of the icon. Note: all those are of
the last icon selected in any command that uses more than
one icon. If #result == 0, then if #result2 == 1, then the
icon wasn't found, or if #result2 == 10, then XitLoadWB
couldn't be found (either it wasn't loaded, or it didn't
work correctly.)
So, to test for XitLoadWB being loaded, just do a:
WB DESELECT
IF #result
CON ECHO "XitLoadWB is running."
ENDIF
Note: No window select command is needed when using the WB
----- commands. These automatically operate on the Workbench
window. They will not change the currently selected window.
----------------------------------------------------------------------------
Scripit Window Commands
=======================
The window control commands consist of mostly commands that control the
window's size, placement, activation, etc. The following is a list of those
commands:
W MOVE x,y
Moves the selected window by x (Horz) and y (Vert). Full limit
checking is implemented so that a window cannot be moved outside
the screen it is on. If the specified x & y are not possible,
the window will move in the direction requested as much as
possible. E.G. window move -20,10 will move the window 20
pixels to the left and 10 pixels down.
W MOVETO x,y
Moves the selected window to position x (LeftEdge) and y
(TopEdge) with full limit checking. If the specified x,y are
not possible, the window will be placed in as near a position to
the requested position as possible.
W RESIZE width,height
Change the selected window's height and width by +/- the
specified width and height. The requested parameters will be
checked against the actual screen limits as well as the window
limits set by the program owning that window. The window will
be resized as much as possible. (A SIZEVERIFY and/or a NEWSIZE
message will be sent if the appropriate flags were set in the
window's flags.)
W RESIZETO width,height
Resize the selected window to a new width and height. The
requested width/height will be checked against the actual
screen limits as well as the window limits set by the program
owning that window. The window will be resized as much as
possible. (A SIZEVERIFY and/or a NEWSIZE message will be sent
if the appropriate flags were set in the window's flags.)
W MAXSIZE Expand the selected window to the maximum size possible.
I.E. to either the screen limits or the window limits whichever
is smaller.
W MINSIZE Shrink the selected window to the minimum size possible.
W FRONT Move the selected window to the front of all other windows.
This simulates clicking on the window's 'to front' gadget.
W BACK Move the selected window to the back of all other windows.
This simulates clicking on the window's 'to back' gadget.
W CLOSE Send a message to the program owning the selected window
requesting that it closes the window. This actually simulates
clicking on the window's 'close' gadget. If the program
wants to close the window then, it will. Scripit will not
attempt to force-close the window.
W REFRESH Send a REFRESHWINDOW message to the selected window. This
tells the program owning the window that it needs refreshing.
It is up to that program to decide whether it wants to refresh
it or not.
W REFRESHFRAME
Manually refreshes the window's title bar and frame gadgets.
W ACTIVATE Activate the selected window. This simulates clicking anywhere
in that window to make it receive all intuition input.
(If the window requires an ACTIVEWINDOW message, one will be
sent to it.)
W DEACTIVATE
Deactivate the selected window. (If the window requires an
INACTIVEWINDOW message, one will be sent to it.)
W LIMITS min_x min_y max_x max_y
Change the preset limits for resizing a window to new limits.
(This might be dangerous if the program owning the window
depends on the window not being smaller or larger than a
specific size.)
Note 1: In all WINDOW commands, WINDOW can be replaced with a 'W'.
------- e.g. 'WINDOW LIMITS' is the same as 'W LIMITS'.
Note 2: Always use 'WAIT' to introduce delays between functions that
------- move, resize, open, close windows to allow enough time for
Intuition and/or the program to respond to the previous command.
(e.g. If you do a MOVETO 0,0 and then a MAXSIZE without a delay
between the two, Intuition will probably not have moved the
window yet at the time Scripit is requesting a resize. This
will mess up the resize and can have serious effects.)
----------------------------------------------------------------------------
Scripit Screen Commands
=======================
These control the screen that the selected window belongs to. You can use
the SELECT SCREEN command to select which screen these commands will act
upon.
SC FRONT Move the selected screen to the front of all other screens.
This simulates clicking on the screen's 'to front' gadget.
SC BACK Move the selected screen to the back of all other screens.
This simulates clicking on the screen's 'to back' gadget.
SC FLASH <times> <delay>
'Flash' the selected screen once. The optional keyword <Times>
controls how many times to flash the screen and the keyword
<Delay> controls the delay between each flash (in 1/50 seconds.)
SC MOVE x,y
Moves the selected screen by x,y. This simulates dragging the
screen. (The x drag does not work. It is included for possible
enhancements to Intuition in the future that might allow
horizontal movements of a screen.) Both x and y can be positive
or negative.
SC MOVETO x,y
Moves the selected screen to x,y. (read note in above command)
x and y can only be positive.
Note: In all SCREEN commands, SCREEN can be replaced with 'SC'.
----- e.g. 'SCREEN FLASH' is the same as 'SC FLASH'.
----------------------------------------------------------------------------
The Scripit ARexx Interface
---------------------------
Scripit can be loaded in 'resident' mode, in which case it will open a port
for ARexx and wait for commands and requests from ARexx.
To load Scripit in Resident mode:
Scripit -x [portname]
Where [portname] is the name of the port that Scripit will open. If no
portname is specified, 'XIT' will be used.
After that, Scripit will just sit and wait for commands from ARexx.
From ARexx:
-----------
To find Scripit's port:
address 'XIT'
To issue a command to Scripit:
'commandname arg1 arg2 ... argN'
For Example:
address 'XIT'
'select Screen Window'
'closewindow'
Or:
address 'XIT' 'flash'
Example ARexx Script:
/* Test ARexx Scripit */
address XIT
'verbose off'
'select wait 500 ABORT'
'wb open dh2'
'wb open access'
'wb open Access!'
'select Access ^5'
'menu Phone Re-dial'
This script will:
1. Find Scripit's portname.
2. Make sure that verbose mode is off. (just in case it was turned
on earlier by another script.)
3. Set the select wait delay to 500 (10 seconds) and abort mode on.
(read the select commands section for details.)
4. Open the Workbench DH2 icon.
5. Open the 'Access' drawer from DH2's window.
6. Load Access!
7. Wait for all of Access's five windows to come up.
8. Send a 'Phone' 'Re-dial' command to Access.
Getting Results from Scripit:
-----------------------------
The command sent from ARexx to Scripit can be any valid Scripit command.
There are also a set of special 'Query' commands that only work with
ARexx.
The Query commands return a result string to ARexx from Scripit
depending on what the Query command was. You MUST, however, turn on the
RESULTS option in ARexx before using any Query command, otherwise no
result will be returned.
The file 'Test.rexx' has an example rexx script that sets the RESULTS
option on, loads Scripit, waits for Scripit to load, then sends the some
query commands to Scripit.
The following is the list of Query commands:
Query Commands: For use with ARexx only
----------------------------------------
QUERY WINDOW
Returns the name currently selected window.
QUERY SCREEN
Returns the name of the screen of the currently selected window.
QUERY WINDATA
Returns data on the currently selected window in the following
format:
[LeftEdge] [TopEdge] [Width] [Height]
QUERY SCREENDATA
Returns data on the currently selected screen in the following
format:
[LeftEdge] [TopEdge] [Width] [Height]
QUERY WINLIMITS
Returns the window limits of the currently selected window in
the following format:
[MinWidth] [MinHeight] [MaxWidth] [MaxHeigth]
QUERY ACTIVEWINDOW
Returns the name of the currently active window.
QUERY ACTIVESCREEN
Returns the name of the currently active screen.
QUERY SCREENFLAGS
Returns a string with the mode of the current screen.
QUERY WINDOWFLAGS
Returns a string with the mode of the current window.
QUERY TEXTMODE
Returns the current text mode of the selected window.
Format: [Left] [Top] [FrontPen] [BackPen] [DrawMode]
e.g. 10 10 1 0 JAM1
QUERY FONT
Returns the current font of the selected window.
Format: [Fontname] [Fontsize]
e.g. topaz 11
QUERY MODE <mode>
Sets the current result returning method to ARexx. Mode can be
SHORT, LONG, or BOTH.
QUERY POINTERPOS
Returns the current position of the pointer in the front screen.
Format: [pointer x] [pointer y]
QUERY MOUSEPOS
Returns the current position of the mouse relative to the
currently selected window.
Format: [mouse x] [mouse y]
QUERY PATH <filename>
Returns the full path to the file or directory specified.
The returned string will contain the full pathname to the file.
QUIT This will tell Scripit to leave the resident mode, close its
ARexx port, and quit completely. Only use this if you really
want Scripit to unload itself.
Note: In all QUERY commands, QUERY can be replaced with a question
----- mark. e.g. 'Q WINDOW' is the same as 'QUERY WINDOW'.
----------------------------------------------------------------------------
COMMAND ARGUMENTS
-----------------
The argument(s) to any command of the above can be either a string, an
integer, or a string variable, an integer variable, or even a forumla.
For example:
con echo "Test"
con echo 1234
con echo $test
con echo #test
con echo #test/(10+2)
Since these are all fed into Scripit as strings, it has to decide what to do
with the argument based on the following logic:
1. If the first character of the is a $, then this is a string variable.
2. If the first character of the is a #, then this either an integer
variable or an equation starting with an integer variable.
3. If the first char of the string is neither, then it is a either a
string or an integer, based on the command that interprets it.
Notes:
- The quotes make no difference when evaluating the argument, they just
serve to seperate arguments.
- If you wish to use double quote character as part of the argument string,
you can use the alternate double quote character: (~).
For example:
PRINT ~This is a "test" of using double quotes (").\n~
You will get:
This is a "test" of using double quotes (").
----------------------------------------------------------------------------
LOGIC AND FLOW CONTROL
======================
Scripit supports the following logic and flow control commands:
BEGIN:
------
BEGIN is the command that marks the beginning of a script. This is
essential and MUST be included in every script. Scripit currently scans for
the BEGIN statement and will start execution of the script at that point.
If it doesn't find the BEGIN statement, it will start execution at the first
line of the script. However, future versions of Scripit will _not_ execute
any script that doesn't have the BEGIN statement, so make sure you use it
always.
LABEL/GOTO:
-----------
Labels define specific points in a script. The GOTO command is then used
to continue execution of the script at the requested label. Example:
LABEL EndlessLoop
con echo "aaaa"
GOTO EndlessLoop
Label names are not case-sensitive and are significant upto 24 characters.
Double-quotes are only needed for label names when you want to use spaces,
tabs, or commas in the label name.
You can also use the shorthand version of the LABEL command. Just use the
label name and a colon. e.g.:
EndlessLoop:
con echo "aaaa"
GOTO EndlessLoop
GOSUB/RETURN:
-------------
GOSUB and RETURN work exactly as in BASIC. GOSUB transfers execution to
a subroutine while preserving a return pointer to the next line after
the GOSUB statement. A RETURN statement picks up the last return pointer
stored on the return 'stack' and continues execution there. For example:
IF #a > 100
CON ECHO "WARNING: Value is too high"
GOSUB Complain
END
Complain:
CON ECHO "A = " #a
RETURN
You can nest upto 24 levels of GOSUBS. Scripit will abort with an error
message if you pass that level.
IF/ELSE/ENDIF:
--------------
IF evaluates a statement and based on whether that statement is true
(non-zero) or false (zero) it will execute other statements. The format
of the IF construct is like this:
IF #a >= 10
do something
ELSE
do something else
ENDIF
or:
IF $test
do something
ENDIF
The ELSE part of the construct is optional, but the ENDIF statement is
essential. You can nest IF constructs to as many levels as you like.
Indenting nested IFs is recommended for clarity. The section 'Mathematical
Expressions' explains IF evaluation more.
Note: Only a GOTO statement can break out of an IF construct.
WHILE/ENDWHILE:
---------------
The WHILE/ENDWHILE construct allows you to write loops more easily. The
format of the while loop is:
WHILE #a <= 10
#a = #a + 1
CON ECHO #a
ENDWHILE
You can nest upto 24 levels of WHILE constructs. GOTOs do _not_ break out
of the while construct. For example:
#a = 1000
WHILE #a > 10
IF #a > 100
GOTO Test
ENDIF
CON ECHO #a
LABEL Test
#a = #a - 10
ENDWHILE
END:
----
The END statement simply ends execution of the script. For Example:
IF #a > 1000
CON ECHO "Value too big."
END
ENDIF
SCRIPT/SUBSCRIPT:
-----------------
The SCRIPT command allows you to execute another Scripit script from within
a script. E.G.
SCRIPT a_script_name
Script execution will stop at the current point in the old script and will
_not_ return. Scripit will end when the new script ends. The SUBSCRIPT
command is identical except that control returns to the calling script one
the called script ends.
All variables are preserved and will be shared between scripts!
----------------------------------------------------------------------------
Sending Text to a program
=========================
Scripit can send text to any program via the 'KEY' command. This command
will translate the string text argument into a set of raw key events that
are sent to the currently selected window based on a set of rules:
Rule 1: If the window selected is looking for raw key events, the raw
keys will be sent its its message port.
Rule 2: If the window selected is not looking for raw key events, the raw
keys will be sent to the input device. This will then be filtered
by Intuition and sent to the currently active window. So, you must
make sure that the selected window is active by using the
ACTIVATEWINDOW command.
Rule 3: When translating the string argument, all characters will be
converted to raw keys, except when a '\' (a backslash) is found.
The backslash is a command that allows you to specify special keys.
The following table summarizes the backslash commands:
Special "KEY" Format:
---------------------
\a Alt Qualifier \o (unused)
\b Backspace \p Pad Qualifier
\c Control Qualifier \q Double-Quote (")
\d Delete \r Right Qualifier Modifier
\e Enter Key (on numeric pad) \s Shift Qualifier
\f Function Key: F0 to F9 \t Tab
\g (unused) \u (unused)
\h Help \v Mouse Button Qualifier
\i Turn on input device mode \w Mouse Button Click
\j Turn off input device mode \x Escape
\k (unused) \y (unused)
\l Left Qualifier Modifier \z End Qualifier.
\m Amiga Qualifier \\ Backslash
\n Return Key \### ASCII code. (000 to 255)
Notes:
The \a, \s, \m and \v qualifier commands always default to using the
left key. e.g. \a will use the Left Alt key. If you need to send
a Right Alt key, use the qualifier modifier 'r' i.e. \ra (or \rs,
\rm) For the mouse buttons, you _must_ specify the left or right
modifier: e.g.: \lv is the left mouse button, \rv is the right mouse
button. Using \v only will simulate the middle mouse button, which
is currently supported by the Amiga's system software, but not by
most programs. The \w 'mouse button click' need to \z since it is
considered as a key press itself, unlike the \v.
All qualifier commands: \a, \s, \m, and \c are cumulative. i.e.
\a\s\ch will send an Alt-Shift-Control-h sequence.
If you need to send only qualifier events without any actual keys,
use the \z (end qualifier) command. This will terminate the
qualifier cumulating and send a qualifier rawkey event. e.g.
\c\lm\rm\z will send the infamous Control-LeftAmiga-RightAmiga
sequence! (This will not actually reboot the machine since the
reset sequence is built into the keyboard, not the system.)
If you need to send the rawkeys to the input device, use the \i
command. All text following this will be sent to the input device,
until the string ends, or until the \j command is found.
Important Note:
Some programs prefer the 'enter' (\e) to 'return' (\n). Use as
appropriate. If you get a reverse M instead of an actual return
then you probably need to use the \e instead of \n. The \e is
mostly used when simulating entering text into a gadget via the KEY
command.
Examples:
KEY "Test.\n" Sends 'Test.' then a Return.
KEY "Test,\b.\n" Sends 'Test,' a backspace, then '.' and Return.
KEY "\h" Simulates pressing the Help key.
KEY "\a\rsk" Sends a LeftAlt-RightShift-k.
KEY "\032" Sends the ASCII character # 32.
KEY "\qA Quote.\q" Sends "A Quote." (with the double-quotes.)
KEY "\e" Simulates pressing the Escape key.
KEY "\f2" Simulates pressing Function Key 2. (F2)
KEY "\a\s\f0" Simulates pressing Alt-Shift-F10.
----------------------------------------------------------------------------
VARIABLES
---------
Variables in Scripit are either integer or string variables.
Integer Variables:
------------------
These are all in the format: #varname
e.g. #a #i #test #something .. or even #10 or #1010test
These can be used anywhere instead of any argument. If the argument
for another function is expected to be a string, then the variable is
converted to a string before being passed that function.
e.g. GFX TEXT #var
Variables names can consist of any combination of letters, numbers or
symbols. The first character must always be a # sign. The variable
names are significant upto the first 16 characters. Variable names
are NOT case-sensitive. i.e. #test is the same as #TEST.
You can use any character in the name of variable as long as it is not
one of the following: + - / * = | & ^ % # space
To assign any value to an integer variable just use:
#a = 100
(The command is actually LET #a = 100)
Integer variables can store numbers in the range of -2,147,483,648 to
+2,147,482,647 (i.e. a signed 32 bit integer).
String Variables:
-----------------
These are the same as integer variables, except they all start with a
$ sign. e.g. $variable, $Test, etc.
To assign any string to a string variable use:
$a = "TEST STRING" or even $a = TEST
$a = $b works as well.
To concatenate strings use:
$a = $b $c "TEST" $x #i etc.
NOTE: String and integer variables of the same name are actually the
same variable! If you set a string variable then the value of its
contents are stored in the integer variable of the same name.
SHOWVARS:
---------
To view all current variables issue the command SHOWVARS and you will
get a list of the currently active variables. (non system ones only)
For Example:
SHOWVARS
Variable Name Integer Size String
--------------- -------- ---- -----------------
a 0 14 A Test String
ab 0 20 Another Test String
abc 100 0
Test 0 8 Testing
Info 0 12 Information
avar 123 0
arg[1] 0 14 first argument
arg[2] 0 15 second argument
arg[3] 10 2 10
arg[4] 12 2 12
result 0 0
result2 0 0
result3 0 0
SHOWVARS will also list out the user supplied arguments (arg[1] to arg[9])
at the end of this list, and after those, it will list out the contents
of the three integer and string result variables.
Note: SHOWVARS has a shorthand version: '?'. (intended for use with the
interactive mode.)
You can also specify the variables to show using the SHOWVARS command. e.g.:
SHOWVARS abc Test avar
There is no limit on the number of variables in Scripit. String variables
can store strings of any length. (upto available memory) All variables
are allocated memory and freed on the fly.
Arrays:
-------
Arrays in Scripit are a bit different from other languages. The format for
using them is like C. e.g.: #test[10] where the number between [] is the
element number. The element number can be any valid math formula. e.g.
#test[#a/2].
Arrays do not need to be predefined to be used. They can be of any size.
You can also have negative elements. (e.g. #test[-10]).
Array elements are allocated and used as they are referenced, so if you
only used #test[32], #test[100] and #test[-32], only 3 elements will be
used and allocated memory.
Array elements are the same as normal variables in that you can reference
the same element as either a string or an integer. i.e. #test[100] and
$test[100] are the same variable.
----------------------------------------------------------------------------
SYSTEM VARIABLES
----------------
All 'system variables' are read only variables maintained by Scripit.
They are either string or integer variables and follow the same notation
as normal variables. (i.e. they start with either a $ sign or a # sign.)
System variables can be used in place of ANY argument to any command.
Strings:
--------
Variables:
$screen The title of the currently selected screen.
$window The title of the currently selected window.
$request The returned string from the file requester.
(this contains the full pathname of the selected file.)
$reqdir The directory selected in the file requester.
$reqfile The file name selected in the file requester.
(not the full path)
$scriptname This is the name of the script being executed.
$arg[n] A user supplied argument that is taken from the CLI command:
Scripit [options] [scriptname] [arg1] [arg2] ... [arg9]
This can range from $arg[1] to $arg[9]
(Note: you can access $arg[n] as an integer by using #arg[n])
These args are guaranteed to contain either a valid argument
or a null value, they will never contain garbage.
$time The current time in the format HH:MM:SS
$hour $minute $second contain the current hours, minutes,
seconds.
$date The current date in the format MM.DD.YYYY
$year $month $day contain the current year,month,day.
Note: $month contains a 3 character string with the name of
the current month. e.g. 'Jan'.
$version The version number of Scripit. (Current text # is "1.20")
$currentdir The full pathname of the current directory.
Constants:
$lf The line feed character. (i.e. \n)
Integers:
---------
Variables:
#argcount The number of user supplied arguments. (can range between 0-9)
#time The current time in the format HHMMSS
#hour #minute #second contain the current hours, minutes,
seconds.
#date The current date in the format YYYYMMDD
#year #month #day contain the current year,month,day.
#version The version number of Scripit. (Currently = 120)
The following all apply to the currently selected window and/or screen:
#win.width The window's width.
#win.height The window's height.
#win.top The window's top edge.
#win.left The window's left edge.
#scr.width The screen's width.
#scr.height The screen's height.
#scr.top The screen's top edge.
#scr.left The screen's left edge.
#win.pen0 The window's front pen color.
#win.pen1 The window's back pen color.
#win.mx The x position of the mouse pointer relative to the window.
#win.my The y position of the mouse pointer relative to the window.
$scr.fontname The name of the current font in the screen.
#scr.fontsize The point size of the current font in the screen.
#win.fontsize The point size of the current font in the window.
#win.x The x position of the gfx write pointer in the window.
(This is the one set with GFX MOVE)
#win.y The y position of the gfx write pointer in the window.
#mousex The pointer x position relative to the actual monitor.
#mousey The pointer y position relative to the actual monitor.
The next variables are only for people that know what to do with them:
#win.flags These are the window flags as per the Window structure.
#scr.flags These are the screen flags as per the Screen structure.
Note:
System variables are predefined. However, that doesn't mean that their
names are reserved. You can use the name of a system variable for your
own variable, but after that you won't be able to access the system variable
anymore. i.e. user variable names will override system variable names.
This applies to all system variables including $arg[1] to $arg[9].
----------------------------------------------------------------------------
Mathematical Expressions
------------------------
Scripit can evaluate complex mathematical expressions that contain any
of the following math operators:
^ power
* multiply
/ divide
% Modulo
+ add
- subtract
& AND
| OR
(
) parentheses
The math expression evaluator is called into action ONLY in two commands:
The IF command and the LET (assign) command. (next version will support
math expressions with any command.)
Examples:
LET #a = (100+3)/#b
(the LET keyword is not essential.)
IF #a+100 >= (100+3)^2+#b
The operators are evaluated on a priority basis. The higher priority
operator gets evaluated first. The above list lists them from the
highest to the lowest priority. Parentheses change the priority by
assigning higher priority to expressions between parentheses.
The IF command can use any of the following comparison operators:
> Greater than
< Less than
>= Greater than or equals
<= Less than or equals
== Equals
= Assign (read below)
<> Not equals
No operator
If no operator is provided then the expression is evaluated, and if
it is not 0 then it is true, otherwise it is false. E.g.
IF #a
If the assign '=' operator is used in an IF statement, then the
assignment is carried out and that value is used to determine
true/false. e.g.
IF #a = 100/12
This does the same as:
#a = 100/12
IF #a
NOTE: In both the LET and IF statement, the comparison operator
MUST be separated by spaces. All other arguments do not
need spaces.
----------------------------------------------------------------------------
STRING ASSIGNMENT & COMPARISON
------------------------------
String variable assignment works like this:
LET $a = "test"
LET $beta = "test" $a $a $test
You can only have on argument before the assign operator. All
arguments after it are concatenated into one string and stored
in the string variable specified.
String comparisons work the same way as integer comparisons. E.G.
IF $test
This will be true is $test is defined and contains something, FALSE
if not.
IF $test == "hello"
IF $test >= "hello"
etc.
This is a string comparison that is based on an alphanumeric sort.
e.g. 'abc' is smaller than 'bbc' etc. String length is only used
when the all the letters match. e.g. 'abc' < 'abcd'
With string comparisons, all arguments before the operator are
concatenated into one string, and all arguments after it are
concatenated into another.
IF "abc" $test "bcd" >= $info $test $new
Immediate resolve assignment:
-----------------------------
The ?= operator is the same as the = operator when using string
variables except that the ?= operator resolves integer variable names in
the string immediately. For example:
$test = #date
Using this $test will contain "#date".
$test ?= #date
Using this $test will contain the current date "19890926".
(Note: this only effect assigning integer variables to string variables.
String variable to string variable assign is always immediately
resolved. i.e. $t = $date and $t ?= $date both result in $t
containing "1989.09.26")
Another note: The ?= operator makes no difference when assigning to
integer variables since such assignments are always immediately
resolved.
(I hope this made some sense to you! :-)
For example: The following will open a console window the size of
the front screen:
begin
select active
$console ?= "CON:0/0/" #scr.width "/" #scr.height "/ConsoleTitle"
con open $console
Note: you should always have the integer variable name as a separate
argument. This is because Scripit has no way of telling where the
variable name ends and the rest of the text begins.
----------------------------------------------------------------------------
RESULT CODES
------------
Many commands in Scripit return result codes via the system variables
#result, #result2, #result3, $result, $result2, and $result3. As a rule,
#result will contain a 0 if the command failed, or 1 or above if the command
succeeded.
Each command uses these result codes to return different codes. You can
find out what these codes are in the description of each command in this
file.
Most commands will set/clear the return results except for the following,
which are guaranteed not to modify the result variables:
IF, ELSE, ENDIF, WHILE, ENDWHILE, GOTO, LABEL, GOSUB, RETURN.
----------------------------------------------------------------------------
TIPS & HINTS
------------
You can use the Scripit package (Scripit and Lister, specifically) in order
to remotely control another Amiga via the serial port (or modem) Just issue
a 'newcli aux:' command on the Amiga to be controlled, and then use a
terminal program on the other Amiga. Use Lister to find out what screens or
windows (and menus, gadgets) are on the remote Amiga, and use Scripit itself
to drive the programs on the remote Amiga. If you need more details on how
to do this, leave me a message in Compuserve.
------------------------------------------------------------------------------
Copyright 1989 Khalid Aldoseri. 7 October 1989.
------------------------------------------------------------------------------