>>-SysWinSetDefaultPrinter(description)------------------------><
Note
Example 8.47. RexxUtil - SysWinGetPrinters and SysWinGetDefaultPrinter
/* set default printer */ default = SysWinGetDefaultPrinter() parse var default default",". say 'The Default printer is:' default say if SysWinGetPrinters(list.) == 0 then do say "List of available printers (* = default):" do i=1 to list.0 parse var list.i pname",". if pname == default then say i list.i "*" else say i list.i end say say "Please enter number of new default printer (0 = keep default)" pull i numberOk = .false if i~datatype('W') then do if 0 <= i & i <= list.0 then do numberOK = .true if i > 0 then do /* Assumes we are on Windows 2000 or later. */ parse var list.i pname",". ret = SysWinSetDefaultPrinter(pname) if ret <> 0 then do say "Error setting default printer ("ret"):" SysGetErrorText(ret) end else do say "The new default printer is:" pname end end end end if \ numberOk then do say "You did not enter a valid printer number." end end else do say "Failed to get a list of the available printers." end