Jump to content
Sign in to follow this  

How do I switch printers from a script?

Recommended Posts

Since this question has come up a few times, I thought I would post the Applescript solution to this problem here in the FAQ forum. If you are using a Mac with OS 8.6 or later, the following will allow you to select a desktop printer on the fly from a Filemaker script:

1. Create a Filemaker script.

2. Add a Perform AppleScript step. Click the "Specify..." button.

3. Select "Script Text", and paste the following code into into the text box:


set RequestedPtr to "MyMainPrinter"

tell application "Desktop Printer Manager"

set CurrentPrtr to name of default printer

end tell

--See if the default printer is the one we want

if CurrentPrtr is not RequestedPtr then

--No. So, wait for the current printer's queue to empty

tell application "Finder"


--See if there are print jobs queued up.

set jobs to count of items in folder CurrentPrtr

if jobs < 1 then exit repeat

delay 10

-- wait 10 seconds and check again

end repeat

end tell

--No print jobs remaining. So, switch printers

tell application "Desktop Printer Manager"

set default printer to desktop printer RequestedPtr

end tell

end if


If you want to switch to a printer whose name is stored in a global field, do this:

1. Create a global text field called gPrtrScriptTemplate, and paste the above applescript code into it.

2. Create a global text field called gPrinterName, and enter a valid desktop printer name into it.

3. Create a calculated text field called PrinterScript with the formula:

Substitute(gPrtrScriptTemplate,"MyMainPrinter", gPrinterName)

Now create a Filemaker script again, as above, but instead of specifying "Script Text," specify "Field Value" and select PrinterScript as the field.

Now, whenever you want to switch printers, just perform the above script before you print.

Share this post

Link to post
Share on other sites


Originally posted by BobWeaver:

And for a Windows version....

The following utilities and plug-ins have been suggested from recent forum discussions (I have no personal experience with them)


Change Printer Plug-in

[Edit: added new products to list]

Thanks a lot Bob, I will give a try and let you know.

Share this post

Link to post
Share on other sites

Hi, Bob - quick question for you! I'm on FM6, Mac OS9.

Your AppleScript to switch printers is great! However, I just got a new DYMO Labelwriter 300 and I discovered that it's a USB printer, therefore it doesn't really like this script. What, if anything, can I substitute out to tell it to go to Chooser and find the USB printer (as the Requested, not default), print a label and come back to the default? I've angered FMP with the things I've tried thus far...

Share this post

Link to post
Share on other sites

Hi Snackcakes,

Sorry I'm so slow responding to this post. I've been away from this forum for several months. The method I gave only works with desktop printers. If you can set yours up as a desktop printer, then it should work (in theory). I thought there was some technique for setting up a USB printer that way, maybe some printer utility, but I've never done it myself.

Share this post

Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

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  

  • Who Viewed the Topic

    1 member has viewed this topic:
  • Create New...

Important Information

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