|Log In | Not a Member?||Contact ADC|
DoIt [commandFile [-d[ump]] [-e[cho]]] | [-selection]
The DoIt script executes a series of MPW Shell commands, highlighting each one in turn. The commands can be either in a file or in the current selection of the active window.
The commandFile parameter, unless you specify -selection. The DoIt script does not accept standard input.
Standard output. If you specify -echo, DoIt echoes commands to the Worksheet as they are executed.
DoIt can return the following status codes.
Specifies a file containing a series of MPW Shell commands. The DoIt script opens the file as the active window and executes each command. When all the commands have been processed, DoIt closes the window.
Flags a command execution error by writing all remaining commands, including the one that failed, to the Worksheet and marking them with the To Do marker.
Echoes each command to the Worksheet before execution.
Executes the commands in the current selection of the active window.
The following command lines highlight and execute all the Duplicate commands generated by the Backup tool. This allows you to see the tool's progress as it duplicates files.
Backup -from "HD:Src:" -to "Backup:Src" -a -r -c > out
You could automate the process of the previous example by creating a DoIt menu. The AddMenu command
AddMenu DoIt "DoIt Selection" "DoIt -selection"
creates a menu that can be used to highlight and execute the current selection. For instance, you could use the DoIt Selection menu item to execute a series of commands generated by Make or Backup.
In the following script, DoIt opens the make.out file, highlighting and executing each of the commands generated by the previous Make command. This allows you to see the progression of files being compiled and linked.
Make > make.out
If an error occurs while executing the commands in make.out (for instance, in one of the compiles), DoIt writes that command along with the rest of the commands in make.out to the Worksheet.
At this point you could fix the error in the source file, select the To Do marker, which would select the remaining commands, and select the DoIt Selection menu item to execute the remaining commands.
The DoIt script does not work for a series of commands containing structured commands, such as If statements and loops.