MIAMEX 120: Prompt for Windows printer

Updated and Reviewed April 2012

xcall MIAMEX, MX_WINPTR, status, printer {port, driver, orientation, length, width, formname, duplex, bin, color, resolution}

(Windows/ATE) MX_WINPTR displays a standard Windows printer selection dialog and returns information about the printer selected. This might be useful for building printer initialization files (see Defining Spoolers) based on the selected printer. Or, you can take it one step farther and just use the full Windows printer name (as returned in the printer parameter) directly when sending files to the printer. For more information, see EZSPL.SBR.SBR and PRINT.LIT.

Note that this operation can only take place on a GUI-enabled client, either ATE or some form of A-Shell/Windows.

Parameters

Parameter

Type

I/O

Description

status

Num

out

 0: User cancelled out of the printer selection dialog
-1: Feature not supported (requires ATE or A-Shell/Windows)
-2: Invalid ATE response (ATE must be build 960+)
>0: OK

printer

String

out

the descriptive printer name of the printer selected by the user. This is normally the name which appears under the icon in the printer selection window.

port

String

out

port name. This could be a traditional physical port (like LPT1:), or a logical network port (like NET01: or IP_192.158.200.250).

driver

String

out

name of the driver. In most cases with newer versions of Windows, this will be the universal spooler driver "winspool" (which in turn calls the hardware-specific driver).

orientation

Num

out

1=portrait, 2=landscape

length

Num

out

paper length in tenths of millimeters

width

Num

out

paper width in tenths of millimeters

formname

String

out

name of form (e.g. "Letter", "Legal", etc.)

duplex

Num

out

1=simplex, 2=duplex (vert), 3=duplex (horz)

bin

Num

out

bin number

color

Num

out

1=monochrome (B & W), 2=color

quality

Num

out

If greater than zero, indicates the resolution in DPI. Otherwise: -1 = draft, -2 = low, -3 = medium, -4 = high.

 

Num

History

2012 April, A-Shell 6.0.1248:  Switch to a more modern version of the printer selection dialog for better compatibility with Windows 8. Main visual difference is the addition of the "Apply" button. At the application level, you can now retrieve several additional parameters about the current printer selection: orientation, paper length, width, form name, duplex option, bin, color versus mono, and the quality (resolution). In addition to the new parameters, the status parameter now indicates whether the user hit the "Print" button (1) or the "Apply" and then the "Cancel" (2). Note that this is only for information purposes, since neither "Print" nor "Apply" actually changes the internal default settings in the printer. But the application might choose to interpret the two cases differently.

2006 July, A-Shell 4.9.960:  This function now supports ATE. Thus, the application on the server can now prompt the user to choose a windows printer, and then, using Auxiliary Port Control, send this information to the ATE client prior to printing to it via the DEVICE=AUXLOC: option. Note that to be effective, this requires that a printer init file exist for the specified printer name in the ashcfg: directory of the ATE client—aka %miame%\dsk0\001007).