Format > EXECUTE [{}] Template > Purpose > Executes a command file (script) Location > C:EXECUTE DEMONSTRATION AVAILABLE -> `EXECUTE.ademo` A command file, better known as a script, is a series of AmigaDOS commands that are saved as a text file. EXECUTE will sequentially run the individual command lines in the script. This allows you to group certain commands together to automate repetitive functions. Using the EXECUTE command, to perform a script is, essentially, programming in AmigaDOS. Just as you would create a program by using different commands in a traditional programming language like, BASIC, you are creating a program (script) for AmigaDOS. Like a BASIC Interpreter executes commands in a BASIC program, AmigaDOS' `Command Line Interpreter` (CLI) executes the lines of a script. You can even pass arguments to a script just as you would for a standard AmigaDOS command. This is known as parameter substitution. EXECUTE will use the parameters, or variables, within the script file. To incorporate parameter substitution, an EXECUTE script uses lines that begin with the "period" or "dot" character (.). .KEY or .K ;Argument template, used to indicate that variables ;will be expected for the script .DOT ;Lets you substitute the dot character for another in ;case you need to use the . for something else in the script ;The default is always . .BRA ;changes the bra (left half of a "bracket" enclosure) ;character used when enclosing variable names used during ;substitution. The default bra character is < ;this may sometimes conflict with redirection's < character .KET ;changes the ket (right half of the "bracket" enclosure) ;character used when enclosing variable names used during ;substitution. The default bra character is > ;this may sometimes conflict with redirection's > character .DOLLAR ;changes the character used in accessing Environment or ;variables. The default character is $ .DOL .DEF ;Gives a default value to a script parameter . ;used to signify a comment line. The /A and /K directives can be used with arguments on the .KEY line of a script. This effectively makes the arguments function as they would for a standard AmigaDOS command - as specified By AmigaDOS `Command Templates`. Arguments followed by /A are required; if no matching argument can be found on the EXECUTE command line, an error message is displayed. The /K directive requires the name of that argument as a required keyword for the EXECUTE command line. The following line at the start of a script: .KEY NAME/a, RANK/a, SERIALNUMBER/a, AGE/k requires that arguments for NAME, RANK and SERIALNUMBER be entered and that the keyword, AGE be typed when executing the script. Otherwise an error will be returned. The first line of a script MUST have a dot command in order for other dot commands to be used. If dot commands are used, AmigaDOS will use the T: directory to create temporary files (Therefore, the `logical device name`, T: must be assigned to some directory - by default it is assigned to the RAM:t directory) Before executing the script, AmigaDOS scans the script file for any items enclosed by the BRA and KET characters (default "<" and ">"). These items indicate variables for the script, that will be substituted by the parameters specified in the EXECUTE command line, that match arguments on a .KEY line. There are some AmigaDOS commands that are specifically intended for EXECUTE scripts, including: IF, ELSE, SKIP, LAB, FAILAT and QUIT. These allow script files to take on a structured arrangement and they make it easy to perform the `conditional loops` and `conditional branching` common to traditional programming languages. Basically, any valid AmigaDOS commands can be used in scripts, even the EXECUTE command itself. The order and arrangement that AmigaDOS commands are listed, affects how the script will function. A script is aborted with the keyboard BREAK sequence Ctrl-D. The current Shell number can be referenced by the characters <$$>. This is useful in creating unique temporary files, logical assignments, and PIPE names. Just as you would have AmigaDOS display the template of a standard AmigaDOS command by using the ? mark, you can display a scripts template by issuing: EXECUTE script ? This will display the template defined by the .KEY line in the script. NOTE: In any of the presented examples for scripts we will list a functional script and include comments (listed after the semicolon character) to explain each line of the script, step-by-step. SEE -> `Scripts` SEE ALSO -> `IF` `ELSE` `SKIP` `FAILAT` `LAB` `ECHO` `RUN` `QUIT`