PrintGetPrinters PowerScript function
Description
Gets the
list of available printers.
Syntax
|
1 |
<span>PrintGetPrinters</span> ( ) |
Return Values
String. Each printer is listed in the
string in the format printername ~t drivername ~t port
~n.
Usage
The return string can be loaded into a DataWindow using ImportString or separated
using the ~n as shown in the example.
Examples
This example parses printer names from the return
string on the PrintGetPrinters call, then places
each printer name in an existing SingleLineEdit control. If you
have more printers than SingleLineEdit boxes, the last SingleLineEdit
contains a string for all the printers that are not listed in the
other SingleLineEdits:
|
1 |
singlelineedit sle |
|
1 |
long ll_place, i, k |
|
1 |
string ls_left, ls_prntrs |
|
1 |
|
1 |
ls_prntrs = <span>PrintGetPrinters</span> ( ) |
|
1 |
k = upperbound(control) |
|
1 |
FOR i= k to 1 STEP -1 |
|
1 |
   IF parent.control[i].typeof()=singlelineedit! then |
|
1 |
      sle=parent.control[i]    |
|
1 |
      ll_place=pos (ls_prntrs, "~n" ) |
|
1 |
      ls_left = Left (ls_prntrs, ll_place - 1) |
|
1 |
      sle.text = ls_left |
|
1 |
      ls_prntrs = Mid (ls_prntrs, ll_place + 1) |
|
1 |
   END IF |
|
1 |
NEXT |
|
1 |
sle.text = ls_prntrs |
See Also
-
ImportString method
for DataWindows in the DataWindow Reference or the online Help
Document get from Powerbuilder help
Thank you for watching.
Subscribe
Login
0 Comments
Oldest