PDA

View Full Version : Simple Print Server using Automator and Dropbox



vansmith
05-20-2012, 12:40 PM
IntroductionI was recently reading this (http://arstechnica.com/getting-it-done/2012/05/getting-started-with-cloud-print.ars) article on Ars Technica about Google Cloud Print and was inspired by the second last sentence:
Or, if you're a Dropbox user on OS X and feel more comfortable setting things up yourself, you can use Automator to automatically print any file synced to a local Dropbox folder.

I wanted to see how well this would work and after doing some quick work in Automator along with some simple testing, I found an easy way to set up a "print server" ... ... Return to article to continue reading. (http://www.mac-forums.com/blog/simple-print-server-using-automator-and-dropbox/)

louishen
05-20-2012, 02:00 PM
Is there any way to setup 2 folders, say one for A4 and one for A3?

Slydude
05-20-2012, 04:43 PM
The only way I can think of to have more than one of these active is to have one folder in Dropbox for each of the sizes that you want to print (A3, A4, legal, etc). Build the automator workflow and assign it to each of those folders then follow the directions Van outlined.

That should work though I have not configured Dropbox to test it yet.

Nice job Van. Now you've got me wondering what else I can do with Dropbox.

vansmith
05-20-2012, 05:34 PM
I doubt it's possible with Automator actions. Automator's printing functionality is rather limited in that it prints the document or it doesn't. Even the MS Word print action for Automator only offers up a few options (number of copies, collating and print ranges).

Now, you could use command line tools to do this. Setup two folders - one for A4 and one for A3. Let's do the A4 printing first.

For the A4 folder, instead of a print action, create a "Run Shell Script" action. To get the proper command, you'll have to get your printer name first. To do that, open up a Terminal and execute the following:
lpstat -aThat will list your printers. I get the following:
Canon_MP210_series accepting requests since Sun 20 May 12:34:00 2012
PTO_Office_Printer accepting requests since Tue 3 Apr 15:09:41 2012
uOttawa_Printer accepting requests since Thu 25 Aug 11:03:30 2011The name is the first part of each line (Canon_MP210_series, PTO_Office_Printer and uOttawa_Printer). Remember the name of the printer you want to use.

Back to Automator. As the value for your shell script, enter the following:
lp -d “<PRINTER NAME>” -o media=A4 "$@"Replace <PRINTER NAME> with the appropriate value. As you can see, this is for the A4 folder (the media=A4 bit). The "$@" part is used in getting the name of the file that was recently added. You need to get this because the name of the file that is dropped into the folder has to be stored in memory temporarily. This is where we are going to set and get the value of what are called variables (simply put, they're like temporary post-it notes in memory that store content).

A picture truly is worth a 1,000 words and I think a picture will make this more clear. Here's a picture of how I think this might need to be setup for an A4 folder (again, you'll need to replace the printer name):

17372

Now, this is a theory - I haven't got any paper at the moment so I'll leave it up to you to test. If that works as I think it should, once the file is dropped in, the name of the file should be added to memory, retrieved and passed to the command. Let us know how it works! If that works, we can modify it for the A3.

MikeSkillings
03-16-2013, 08:59 PM
Hey,

I have tried all of these but can't seem to get any to work. It keeps saying Workflow Failed or Warning. I am new to Macs so don't know if it is just something really simple I'm missing.

I have everything set up so that when a photo is tagged with my specific tag it is uploaded to my dropbox automatically. I was then hoping to link it so that the newly added files in my dropbox were printed automatically (at 10x15 size if possible).

Can anybody please help me with this? It's for a University project for my final degree and I need to sort this out to progress with my project.

Thanks,

Mike

vansmith
03-17-2013, 01:21 PM
Can you post your workflow? What errors and warnings were you getting?

iggibar
03-17-2013, 10:05 PM
Thanks for this tip! Worked flawlessly!

DianneMM
01-24-2016, 10:57 AM
Thanks Vansmith! This works perfectly!

I'd been using GoToMyPC to connect to the office computer from home and to print reports to my home printer.

When my PC died I replaced it with an iMac. Then I learned that GoToMyPC cannot print while connected with a Mac so I was shopping for a Windows PC. At the same time I'd been listening to Mac Power Users podcast that mentioned Automator. I did some googling and came across your tip. I'm so glad I don't have to use Windows at home again. This really saved me!

There is no difference in the speed at which this prints compared to printing with the GoToMyPC print driver from my PC that died.

Great tip!