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

MPW Command Reference


Open

Built-in

SYNTAX

Open [name1] [name2]… [-f] [-n | -r] [-s] [-t]

DESCRIPTION

The Open command opens one or more files as windows, making the last one specified the active window. If you specify a file that is already open as a window, that window becomes the active window.

If the {NewWindowRect} MPW Shell variable is defined, the windows are opened to that size and location.

INPUT

None

OUTPUT

None

STATUS

Open can return the following status codes:

0

no errors

1

error in parameters

2

unable to complete operation; specified file not found

3

system error

PARAMETERS

[name1] [name2]…

Specifies one or more files to be opened as windows. If you do not specify any files, SFGetFile is called, allowing you to choose a file by using the dialog box. See the GetFilename command for a description of the SFGetFile dialog box.

OPTIONS

-f

Sends an AppleEvent to the Finder to have the Finder open the specified file or folder.

-n

Opens one or more new windows. If you specify a window name that already exists, that window is opened as the active window.

Notice that "Open -n" and "New" both open windows. The difference is that "Open -n" allows you to either create new windows or to open existing ones, but "New" opens only new windows.

-r

Opens read-only windows. Normally the named files open as write-enabled windows.

Note that an error occurs if you use this option and specify a file that does not exist.

-s

Sends an AppleEvent to the Finder to have the Finder open the folder enclosing the specified file or directory.

-t

Opens the last file specified as the target window rather than as the active window. This option is identical to the Target command.

EXAMPLES

The following command displays an SFGetFile dialog box from which you can choose a file to open:

Open

When executed, this command line opens the file Test.a as the target window in read-only mode:

Open Test.a -r -t

Using the ≈ wildcard character, this command line opens all the files that end with .a:

Open ≈.a

SEE ALSO

Close

New

Target

 
 


Last Updated July 2000