long                           ll_rows
string                         ls_getPrinter
string                         ls_getPrinters
string                         ls_printerName
dataWindowChild                 ldwc_printers


// Get a list of available printers.
ls_getPrinters = printGetPrinters( )
// Populate the DataWindow with the printers.
ll_rows = dw_printer.importString(ls_getPrinters)


if ( ll_rows > 0 ) then
  // Populate the drop down DataWindow with the
  // available printers as well.
  dw_printer.getChild("s_printer_name", &
    ldwc_printers)
  ldwc_printers.importString(ls_getPrinters)


  // Get the current printer and scroll to that
  // row in the DataWindow.
  ls_getPrinter = printGetPrinter( )
  ls_printerName = left(ls_getPrinter, &
    (pos(ls_getPrinter, "~t") - 1))
  dw_printer.scrollToRow(dw_printer.Find &
    (("s_printer_name = '" + &
    ls_printerName + "'"), 1, ll_rows))
end if



string                         ls_getPrinters
string                         ls_printerName


ls_getPrinters = printGetPrinters( )


// Get the first printer in the list.
ls_printerName = left(ls_getPrinters, &
    (pos(ls_getPrinters, "~t") - 1))


// Set the printer to use for the next
// print task.
printSetPrinter(ls_printerName)