Jump to content
Sign in to follow this  
Slamdunk

VBScript to swap printers in registry

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

Share this post


Link to post
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.

Share this post


Link to post
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.

Share this post


Link to post
Share on other sites

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)

Share this post


Link to post
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.

Share this post


Link to post
Share on other sites
Guest
You are commenting as a guest. If you have an account, please sign in.
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Sign in to follow this  

×

Important Information

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