Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

How can i change the Default / Current Printer assignment

Status
Not open for further replies.

Guest_imported

New member
Jan 1, 1970
0
I have a PB application that creats a graphical report and prints it using the print() function in the script.

I want to redirect the report output to a HP directJet printer on the Network instead of it going to the workstations default printer, which is also on the network.

I can run the application and it will print to the HP printer but only if its the Default.

In the BP datawindow Script is there a print() function or method i can use to reassign the output to the HP printer to print the report then reassign back to default printer.

Thanks Much
Junk
 
Have you trayed PrintSetup() function? This will give posibility to change the printer and some other parameters.
regards,
Zibi
email:zbyszek@pangea.com.pl
 
You can change the registry setting on the machine your app runs on so that PB uses a "new" default printer and then change it back after you've finished printing. The registry setting your after is ...

"HKEY_CURRENT_USER\Software\Microsoft\Windows NT\CurrentVersion\Windows", "Device",

Note that an extension is required which you can determine from the following...

integer l_ndx, l_max
datastore dw_printer_names
string ls_devices[], ls_extension
dw_printer_names = create datastore
dw_printer_names.DataObject = 'dddw_printer_names'
if RegistryValues ( "HKEY_CURRENT_USER\Software\Microsoft\Windows NT\CurrentVersion\Devices", ls_devices ) = -1 then
MessageBox( "Registry Lookup Error", "Failed to find devices." )
return dw_printer_names
end if
l_max = UpperBound( ls_devices )
for l_ndx = 1 to l_max
dw_printer_names.InsertRow( 0 )
dw_printer_names.Object.printer_name[l_ndx] = ls_devices[l_ndx]
RegistryGet ( "HKEY_CURRENT_USER\Software\Microsoft\Windows NT\CurrentVersion\Devices", &
ls_devices[l_ndx], RegString!, ls_extension )
dw_printer_names.Object.device_extension[l_ndx] = ls_extension
next

return dw_printer_names
 
Junk_male, we have the same problem. Firrip's suggestion is great but I dont know how to handle the registry, I hope he can really spell it out like the actual code to modify the registry, maybe you've figured it out, can you post the actual code to modify the registry...
Thanks.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top