Tools: MPW
Advanced Search
Apple Developer Connection
Member Login Log In | Not a Member? Contact ADC

MPW Command Reference


DoIt

Script

SYNTAX

DoIt [commandFile [-d[ump]] [-e[cho]]] | [-selection]

DESCRIPTION

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.

INPUT

The commandFile parameter, unless you specify -selection. The DoIt script does not accept standard input.

OUTPUT

Standard output. If you specify -echo, DoIt echoes commands to the Worksheet as they are executed.

STATUS

DoIt can return the following status codes.

0

no errors

1

syntax error

n

any status code returned by a command executed by DoIt

Note
If an error occurs while executing a particular command, the MPW Shell returns the status code that is appropriate to that command. •

PARAMETERS

commandFile

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.

OPTIONS

-d[ump]

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.

-e[cho]

Echoes each command to the Worksheet before execution.

-selection

Executes the commands in the current selection of the active window.

EXAMPLES

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
DoIt 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
DoIt make.out -dump

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.

LIMITATIONS

The DoIt script does not work for a series of commands containing structured commands, such as If statements and loops.

 
 


Last Updated July 2000

Get information on Apple products.
Visit the Apple Store online or at retail locations.
1-800-MY-APPLE

Copyright © 2004 Apple Computer, Inc.
All rights reserved. | Terms of use | Privacy Notice