Scripit -- The Intuition Script Language ========================================== By: Khalid Aldoseri ------------------- NOTE: You should read the 'Reference.DOC' file and the 'Examples' file for more information about Scripit. This doc file only tells you how to run the script runner, recorder and lister. It does NOT help you at all in writing scripts. All the details of each command, Scripit's language structure and examples are in the files mentioned above. Scripit: The script executor: ------------------------------ 'Scripit' is the program that runs Scripit scripts. Its operation is very simple. To use Scripit just issue the following command from CLI: Scripit scriptfilename The format of the Scripit scriptfile should be normal text lines ending with a carriage return. Format: Scripit [flags] [scriptfile] [arg1] [arg2] ... [arg9] Flags: -v Turns on Verbose mode. -d Turns on Debug mode. -x Loads Scripit Resident Arexx mode. Format: Scripit -x [portname] Where PortName is the portname Scripit will be referenced by from ARexx. -c Compile Script. Format: Scripit -c [input file] [output file] -w Disable Warnings. Scripit's commands control other programs by manipulating their menus, gadgets windows, and screens. The programs being controlled do not need any special ports as all the messages they receive are simulated Intuition messages. In fact, the programs don't even recognize that it isn't Intuition talking to them! You can also run Scripit from WB by clicking on its icon and then selecting the script file from the file requester. (The file requester will first search for a directory called Scripit:. If it doesn't find it, it will use the current directory.) The arguments entered after the script name are accessible via the system variables $arg[1] to $arg[9]. (see Reference.DOC) Once a script has started running you can abort it at any time by pressing the control key and the left mouse button at the same time. You can also pause the script by using the left shift+left mouse button, and to resume execution, use right shift+left mouse button. More details in Reference.DOC. Compiling Scripts: ------------------ Scripit can compile scripts into a special format that is usually around 30%-50% smaller in size than the original file and runs a lot quicker. These files are automatically identified by Scripit. To compile a script: Scripit -c [inputfile] [outputfile] e.g. Scripit -s Access Acc This creates a compiled file called 'Acc'. To run a compiled script: Scripit Acc OR Xit Acc 'Xit' is a special version of Scripit that _only_ runs compiled files. It is a lot smaller in size than Scripit, which allows it to load a lot faster. If you try to execute a non-compiled script with 'Xit' it will just quit. Note: Compiled Scripit files can be identified by the first four bytes in the file. They are 'X' 'I' 'T' '2'. When you specify a non-compiled script file name to Scripit, it will automatically compile it and then run it. However, if Scripit cannot read in the whole file at once, (like when using '*' as a file name or through pipes or if it cannot allocate enough memory to load in the whole file at once) it will compile and execute it line by line. Using 'Scripit *' will allow you to enter the 'live mode' where you can enter commands directly from the console and each command will be executed one by one as you type them in. Using Scripit from Workbench: ----------------------------- To use Scripit from the Workbench just double-click on its icon. The file requester will come up allowing you to select a script file to execute. You can also auto-invoke a script by double-clicking on the script file's icon. Both 'Scripit' and 'Xit' can execute scripts this way, however 'Xit' doesn't have a file-requester. You can use any icon file as the script icon as long as it is a project icon can be used. Just make sure that the tool name points to either Scripit (for normal scripts) or Xit (for compiled scripts.) Supporting Programs: -------------------- 1. Recorder: This is a general Intuition event recorder that records what the user is doing and saves it to a file you select. This saved file is totally compatible with Scripit and when run from Scripit it will recreate the original user activities as closely as possible. This is _not_ a keyboard and mouse macro recorder. It actually records all messages going from Intuition to the currently active window. It will also monitor what the active window is, and if it changes Recorder will add the necessary commands to change the active window in the script as well. The concept behind Recorder is that of a utility that helps you in writing scripts. The script files generated by Recorder are normally long-winded since Recorder has no way of finding out which actions are necessary and which aren't. It is best to use the scripts generated by Recorder as the first step in writing a script, then editing them to make them smaller, faster, and maybe even add variables or flow and logic control to them. The file created by Recorder can be edited as it is a normal script file. To use Recorder, just run it from CLI: Recorder scriptfilename After that do all the 'actions' you want, and when you want to stop the recording, send it a Control-C by either clicking into the CLI window and pressing Control-C or by using the 'break' command, or by closing its window. (Note: the power LED will flicker as long as it is recording.) To execute the saved script just use: Scripit scriptfilename Recorder has several options. (Use Recorder ? to see the options.) Format: Recorder [-flags] [scriptfile] Flags: -c Adds comments to script. -w Do not open display window. -l Disable power LED activity meter. -n Use menu & gadget numbers instead of text. -t Disable time recording. -m Disable MouseMoves recording. -i Disable Intuiticks recording. 2. Lister This is a general screen, window, menu and gadget listing facility that will help in identifying the correct names or numbers of the items to be controlled. To use Lister, just run it. You will get a list of screens in the system. You can then see the windows in a specific screen by typing the first few letters of the screen name as Lister's first argument. You can go on to specify window, menu, menuitem, subitem, or gadget. The format is: Format: Lister [screen] [window] [menu] [item] [subitem] or: Lister [screen] [window] -g [gadget] 3. XitLoadWB This program allows Scripit to control the WorkBench. Read the doc file 'Reference.DOC' for details on its usage. 4. AutoScript: The Script AutoScript Maker: This will take a normal Scripit script file and make it into an auto- running script. i.e. Instead of typing 'Scripit scriptname' you only have to type 'scriptname'. Command format: Format: AutoScript [] Example: You have a script file in the current directory called 'Shrink'. Contents of File 'Shrink': BEGIN SELECT ACTIVE MOVETO 0,0 MINSIZE Using AutoScript, we make it into an auto executing script in S: by the following command: AutoScript Shrink s: This generates the following script as "s:Shrink" : .key arg1,arg2,arg3,arg4,arg5,arg6,arg7,arg8,arg9 Scripit -w s:Shrink "" "" "" "" "" "" "" "" "" ;BEGIN ;SELECT ACTIVE ;MOVETO 0,0 ;MINSIZE AutoScript will also set the 's' protect bit on S:Shrink. The first line gets all the arguments passed to s:Shrink which are then passed over to Scripit in the second line. After doing this, type 'Shrink' from the CLI will automatically load Scripit, and then load and execute the script file. (When Scripit executes a file, it will ignore the semi-colon if its the first character in the line.) The default destination directory is RAM:. Make sure that the CLI's search path is set to the directory that the script file is in. This example script doesn't use user arguments, but they are still handled correctly by AutoScript. The -w flag is used so that Scripit won't complain on unknown commands. (i.e. the first 2 lines of s:Shrink) NOTES: - This only works with text script files, not with compiled scripts. - You need Workbench 1.3 or higher in order to use this facility. - There is only one known problem with this technique: #argcount is always 9 no matter how many arguments you provide via this method. Notes on file requester: The file requester has two hidden features: 1. click on the right mouse button to get a list of the volume names of devices currently in the system. Click on it again to get the list of 'logical' devices, i.e. assigns; 2. you can resize the file requester, the resize gadget is at the bottom of the requester, all across the bottom border. All comments, suggestions, bug reports, etc. should be sent to: Khalid Aldoseri, CIS 75166,2531. Many thanks to Vic Wagner for his help with the script language, Larry Phillips for coming up with the name 'Scripit', and mostly to Brian J. Bartlett for countless hours in conference testing Scripit and for lots of great suggestions. Official support for Scripit is provided on Compuserve in the AmigaTech forum, under Section 12: Other Languages. Copyright 1989 Khalid Aldoseri.