Changing Windows 95 Applications Default Printer
This example shows how to modify an application's default printer via WinBatch. To see an example of how to change the Windows95 Default printer without having to reboot your system, see "Changing Windows 95 and NT Default Printer" in this directory.
In this example we use FileMaker Pro from Claris, v3.0
FileMaker stores its default printer in its own section of the registry.
In this scenario, a user has two local printers, a HP of somekind, a Panasonic, and a Fax via a modem card. We wish to switch between the three of them.
First we need to set up some registry entries manually.
- First manually set the default printer to the local printer, HP in this case.
- Run RegEdit and locate
HKEY_CURRENT_USER\Software\Claris Corp.\Filemaker Pro\3.0 Preferences- Double Click on the "Printer" data item, highlight the result and hit CTRL-C to copy it to the clipboard.
- Over in the right hand panel of RegEdit, RIGHT-CLICK the mouse and make a NEW STRING VALUE. Give it the name DBDHP and for the value insert the contents of the clipboard CTRL-V
- So far so good. Now for the Panasonic printer.
- Now go back to FileMaker Pro and select the Panasonic as the printer.
- In RegEdit go back to
HKEY_CURRENT_USER\Software\Claris Corp.\Filemaker Pro\3.0 Preferences- Double Click on the "Printer" data item, highlight the result and hit CTRL-C to copy it to the clipboard.
- Over in the right hand panel of RegEdit, RIGHT-CLICK the mouse and make a NEW STRING VALUE. Give it the name DBDPANASONIC and for the value insert the contents of the clipboard CTRL-V
- Almost done now. Now for the Fax.
- Now go back to FileMaker Pro and select the FAX as the printer.
- In RegEdit go back to
HKEY_CURRENT_USER\Software\Claris Corp.\Filemaker Pro\3.0 Preferences- Double Click on the "Printer" data item, highlight the result and hit CTRL-C to copy it to the clipboard.
- Over in the right hand panel of RegEdit, RIGHT-CLICK the mouse and make a NEW STRING VALUE. Give it the name DBDFAX and for the value insert the contents of the clipboard CTRL-V
- OK, now all our stuff is set up. The sample WinBatch code below will switch between the various printers. This code could also be added to a PopMenu menu item.
NB: Watch out for your browser breaking the lines in the wrong places.
Look at the code real carefully before you try to use it.; Example of reading and changing the default printer in Windows 95 ;;;set the printer to HP newprt=RegqueryValue(@regcurrent, "Software\Claris Corp.\Filemaker Pro\3.0 Preferences[DBDHP]") RegSetValue(@regcurrent, "Software\Claris Corp.\Filemaker Pro\3.0 Preferences[Printer]", newprt) ;;;set printer to Panasonic newprt=RegqueryValue(@regcurrent, "Software\Claris Corp.\Filemaker Pro\3.0 Preferences[DBDPANASONIC]") RegSetValue(@regcurrent, "Software\Claris Corp.\Filemaker Pro\3.0 Preferences[Printer]", newprt) ;;;; set Printer to Fax newprt=RegqueryValue(@regcurrent, "Software\Claris Corp.\Filemaker Pro\3.0 Preferences[DBDFAX]") RegSetValue(@regcurrent, "Software\Claris Corp.\Filemaker Pro\3.0 Preferences[Printer]", newprt)And here is some PopMenu code.
Set the printer to hp newprt=RegqueryValue(@regcurrent, "Software\Claris Corp.\Filemaker Pro\3.0 Preferences[DBDHP]") RegSetValue(@regcurrent, "Software\Claris Corp.\Filemaker Pro\3.0 Preferences[Printer]", newprt) Set printer to Panasonic newprt=RegqueryValue(@regcurrent, "Software\Claris Corp.\Filemaker Pro\3.0 Preferences[DBDPANASONIC]") RegSetValue(@regcurrent, "Software\Claris Corp.\Filemaker Pro\3.0 Preferences[Printer]", newprt) Set Printer to Fax newprt=RegqueryValue(@regcurrent, "Software\Claris Corp.\Filemaker Pro\3.0 Preferences[DBDFAX]") RegSetValue(@regcurrent, "Software\Claris Corp.\Filemaker Pro\3.0 Preferences[Printer]", newprt)
Article ID: W13686Filename: Changing Windows 95 Applications Default Printer.txt