Jump to content

VBScript to swap printers in registry


This topic is 6195 days old. Please don't post here. Open a new topic instead.

Recommended Posts

Hi Guys,

I managed to run the vbscript. It does changes the printer in the registry and changes the windows default printer, but it still doesnt change the printer in the FM. Any help?

The VBscript is as follows:

Set WshNetwork = CreateObject("WScript.Network")

set WshShell = CreateObject("WScript.Shell")

Serv = "DBS-EMAC"

Printhere = "MFC-9160"

AddSettings = ",winspool,DBS-EMACMFC -9160"

FullPrinterName = ("" + Serv + "" + printhere)

WshNetwork.SetDefaultPrinter FullPrinterName 'This sets the default printer for the computer NOT JUST FILEMAKER

WshShell.RegWrite ("HKEY_CURRENT_USERSoftw areFileMakerFileMaker Pro8.0preferencesprinter"),F ullPrinterName +

AddSettings,"REG_SZ"

WScript.Quit

Link to comment
Share on other sites

If the printing is scripted in FileMaker, try deleting any 'Page setup' and 'Print' script steps from your print script, close the script, open it again and put them back.

This should make it 'forget' any print settings that may have been saved with the script.

Link to comment
Share on other sites

Once you have run your vbs script you must then use a Print setup script step (no dialog) to set that printer in the filemaker file you are printing from.This should fix the problem.

Link to comment
Share on other sites

  • 2 weeks later...

Is this where the default printer is stored in the registry?

HKEY_CURRENT_USERSoftw areFileMakerFileMaker Pro8.0preferences

I have a batch script change that but when i hit Print setup in filemaker, the printer that comes up in the print dialog box is still what the default printer used to be. (except i'm using v7.0)

Link to comment
Share on other sites

"HKEY_CURRENT_USERSoftw areFileMakerFileMaker Pro8.0preferences" this needs modified for what ever versiion you are running (7.0,8.0,8.0A,8.5A...).

And remember Filemaker uses differrant printer settings when you do the Print Setup script set without dialog.

As near as I can figure it. (and if someone has a better understanding of this please let me know)

If you do a Print Setup with a Dialog it will use the printer you specified in the dialog (if avalible).

If you do a print setup without dialog it will set filemakers Defualt printer (the one found in the registy)to the printer being used. (this is normally set when you open the filemaker application and is set to whatever your defualt printer is at that time)

If you do a Print script step without dialog it will print to your Systems Defualt Printer.

That's Close to how it works. ( I got fustrated with it all and just came up with a way to change all three possible printers, problem solved)

This solution is really only usefull if you have a need to print to more than one printer and need it done without dialogs.

Link to comment
Share on other sites

This topic is 6195 days old. Please don't post here. Open a new topic instead.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.