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

MPW Command Reference


Choose

Tool

SYNTAX

Choose name1 [name2]… ([-askpw] [-askvp] [-atalk] [-c] [-guest] [-list]
[-p] [-pw password] [-type typeName] [-u name] [-v] [-vp password]) |
(-pr [-c] [-cp] [-dr driverName] [-list] [-p] [-type typeName])

DESCRIPTION

The Choose tool noninteractively mounts or lists (-list) the specified AppleShare volumes or printer. You can mount or list any number of volumes on a single command line, although a system-dependent limit exists on the number of active server connections; however, you can choose only one printer at a time, because only one print server can be active.

The options that you can use with Choose depend on whether you are choosing file servers or a print server. The tool normally assumes that you are choosing file servers, but you can choose a print server instead by specifying -pr. (For details on specifying file server or printer names, see the name1 [name2]… parameter.)

Table 1 lists the options that you can use for both file servers and print servers, those that you can use only with file servers, and those that you can use only with print servers.

Table 1: File server and print server options

Both

File servers

Print servers

-c
-list
-p
-type typeName

-askpw
-askvp
-atalk
-guest
-pw password
-u name
-v
-vp password

-cp
-dr driverName
-pr

For servers and volumes with restricted access, you can either type your server and volume passwords on the command line (-pw or -vp) or request that a dialog box appear prompting you for passwords (-askpw or -askvp).

Note
If you omit or mistype your password, you will receive a message such as: "No AFPLogin call has been successfully made for this session." •

Choose can connect to file servers using TCP/IP or AppleTalk. If the -atalk option is not specified, Choose will check to see if the server supports AFP over TCP. If so, Choose will try connecting via TCP. If that fails or the server does not support TCP, Choose will connect via AppleTalk.

Note
The server must support AppleTalk access even if connecting via TCP/IP. •

INPUT

None

OUTPUT

None, unless you specify the -list, -v, -cp, or -p options. If you specify -list, Choose writes the names of existing zones, servers, and volumes to standard output. To list these names in the form of Choose commands, specify -c in conjunction with -list.

You can also request that the names of all currently mounted volumes (-v) and the name, type, and driver of the currently mounted printer (-cp) be written to standard output.

If you specify -p, version and progress information is written to diagnostic output.

STATUS

Choose can return the following status codes:

0

no errors

1

syntax error

3

any other error

PARAMETERS

name1 [name2]…

Specifies one or more AppleShare volumes or a printer (-pr), where name is a file server or print server name of the form:

[zone]:[server[:volume]]

If you omit the zone name, Choose defaults to the current zone; however, a server name must be preceded by at least a colon even if you do not specify the zone, as in this example:

':MobyDick:≈'

Note
The ≈ wildcard character used in the previous example can be used in place of a zone, server, or volume name to specify all items of that type. In addition, a leading : (that is, an empty zone name) or *: can be used to represent the current zone. •

Servers can refer to either file or print servers, but volume names apply only to file servers. When mounting file server volumes, you must specify a server name.

If you specify a volume name, only that volume is mounted. For example,

'WhaleZone:MobyDick:BigWhale'

mounts the BigWhale volume on the MobyDick server in the zone WhaleZone.

If you omit the volume name or if you substitute the ≈ wildcard character, Choose mounts all volumes in the specified server. For example, the following two command lines both mount all volumes on the MobyDick server.

'WhaleZone:MobyDick:'
'WhaleZone:MobyDick:≈'

Note
If you use the ≈, :, or ∂ characters in a server, volume, or zone name, you must indicate that they are literal characters by using either single quotation marks or the MPW Shell quote character ∂. This quoting mechanism supplements quoting already performed by the MPW Shell. •

OPTIONS

-askpw

Prompts for the file server password with a dialog box. Do not specify this option in conjunction with -pw or -guest.

-askvp

Prompts for the file server volume password with a dialog box. Do not specify this option in conjunction with -vp or -guest.

-atalk

Connects to file servers using AppleTalk instead of TCP/IP.

-c

Lists zones, servers, and volumes in the form of Choose commands when used in conjunction with -list. For example, the command line

Choose -c -list

might yield the output:

Choose 'WhaleZone:MobyDick:BigWhale'

Note that this option can be used with both file and print servers.

-cp

Writes the name, type, and driver of the currently mounted printer. If you specify this option, Choose provides the information before mounting any new printer.

-dr driverName

Specifies the driver name of the print server being mounted. This must name one of the printer drivers contained in the System Folder (such as 'LaserWriter').

-guest

Logs in on the specified file server as a guest instead of a recognized user.

-list

Lists network zones, servers, and volumes in the form of quoted names. For example,

'WhaleZone:MobyDick:BigWhale'

This option expands the next unspecified item in a name so that a zone name followed by nothing else expands to a list of servers in that zone, and a server name followed by nothing else expands to a list of volumes on the server.

Note
If you specify -list, you can substitute the wildcard character for all of the fields in name (that is, the zone, server, and volume). Note that listing volumes on a server requires a server login--that is, you must use a valid server password or specify -guest. •

Note that this option can be used for both file and print servers.

-p

Writes version and progress information to standard output. This includes the Choose tool's version number and step-by-step progress. This is particularly reassuring for listings that can take several minutes (for example, listing every server on a large network).

Note that this option can be used for both file and print servers.

-pr

Specifies a print server rather than a file server. You must specify this option to choose (that is, mount or list) a print server. This option cannot be used when choosing file servers: You can choose a print server or one or more file servers, but not both.

For a list of the options that can be used when choosing a print server, refer to Table 1.

-pw password

Specifies the file server password. Note that the server password defaults to the value of the MPW Shell variable {ServerPassword} and that all passwords are case sensitive.

Note
You can mount more than one server and volume with a single command as long as the server and volume passwords are the same for each, because at most, one password of each type can be specified. •

-type typeName

Overrides the default to choose or list a different type of file server volume or print server. Type names are not case sensitive.

For volumes, the type name defaults to 'AFPServer'. For printers, it defaults to the name of the current printer driver (such as 'LaserWriter').

Use this option to mount or list network entities of other types (that is, not the 'AFPServer' or the current printer driver). A type name of ≈ or = matches all network entity types.

Note
You cannot mount network entities of certain types. For instance, it is not possible to mount volumes on file servers of types other than 'AFPServer'. •

-u name

Logs on to the file server with the specified user name. This option has precedence over the MPW Shell variable {User}, which in turn has precedence over the user name string in the system resource file ('STR' -16096). If the Chooser cannot find a valid user name at any of the above locations, -guest is assumed.

-v

Lists all mounted file server volumes. Colons are appended to each volume name. This is useful, for example, in writing Shell scripts in which volume names are not known ahead of time.

-vp password

Specifies the file server volume password. Note that the volume password defaults to the value of the MPW Shell variable {VolumePassword} and that all passwords are case sensitive.

Note
You can mount more than one server and volume with a single command as long as the server and volume passwords are the same for each, because at most, one password of each type can be specified. •

EXAMPLES

The following command line mounts the volume Sources on the server Linker, located in the current zone, using the default user name, and the default server and volume password.

Choose :Linker:Sources

Upon executing the following command line, Choose first mounts the volume Doc on the server Sources and every volume on the server Games in the zone Systems as a guest. It then prints the names of the currently mounted volumes (-v). Notice that the wildcard character is enclosed in quotation marks.

Choose 'Systems:Sources:Doc' 'Systems:Games:≈' -v -guest

The -askpw option prompts you for a server password with a dialog box. The following command line prompts you for your password for the Moby Dick file server before mounting it.

Choose 'Whale Zone:Moby Dick:≈' -askpw

Using -list in the following command line causes Choose to list all file servers in the zone Whale Zone, all volumes on the Moby Dick file server in that zone (after logging in with the default user name and server password), and all zones (with their servers).

Choose -list 'Whale Zone:≈' 'Whale Zone:Moby Dick:≈' '≈:'

In the following script, the first command line lists all print servers in the current zone. The second command line prints the name of the currently mounted printer, and then mounts the printer called Kitchen Sink in the zone Zarf.

Choose -pr -list ':≈'
Choose -cp -pr "Zarf:Kitchen Sink"

By default, Choose allows you to mount file servers of type 'AFPServer'. Although you cannot mount servers of other types, you can list them. To list servers of type "Fortune Cookie" in all zones, you use the following command line:

Choose '≈:≈' -list -type "Fortune Cookie"

SEE ALSO

Unmount

Volumes

 
 


Last Updated July 2000