Updated April 2012
? tab(-10, AG_WINPTR); chr(127);
AG_WINPTR (56) brings up the "select printer" dialog. The selected printer name, along with the port and driver are returned in the keyboard buffer. For example:
? TAB(-10,AG_WINPTR);chr(127);
INPUT STATUS,PTRNAME$,PTRPORT$,PTRDVR$,ORIENTATION,LENGTH,WIDTH,FORMNAME,DUPLEX,BIN,COLOR,QUALITY
STATUS will be 1 if the user selected a printer, else 0
See MX_WINPTR for the definitions of the remaining parameters.
Note that since ATE and A-Shell/Windows versions prior to 6.0.1248.0 will only return the first four fields, and that INPUT will continue to prompt for parameters that were not supplied, you should first check the version and use an appropriate INPUT statement. Using MX_WINPTR avoids the issue entirely. Another approach would be to use INPUT LINE to get the entire response, then parse it manually, either using INSTR or STRTOK.SBR.
History
2012 April, A-Shell 6.0.1248: Added all parameters after "PTRDVR$"