Archive for Hazel

Using AppleScript to make a Scanner & Printer into a Copier

My printer/scanner/copier does a poor job of copying and scanning multipage documents. My scanner does a great job of scanning multipage documents. Instead of taking the 50/50 risk that anything I put in the copiers tray would cause a paper jam, I started scanning everything to PDF and then printing the PDF. Since I’m always looking to shave a few seconds off of a workflow, I thought an AppleScript would be handy to do all of this for me.

When I want to copy a document, I go through the following process:

1. Select the the “Copier” profile that I created the ScanSnap Manager. This profile scans at high quality, names the newly created file “copier0001.pdf” and places that file in the Documents folder

2. Hazel will (after a few seconds) recognize the file and begin the execution of the AppleScript.

3. The scanned file is opened in PDFpenPro. (I use PDFpenPro for this because I’ve found that it is far more “scriptable” than Adobe Acrobat).

4. The script asks me how many copies of the document I want.

5. The script send the print job to the default printer, closes the scanned PDF, and quits PDFpenPro.

6. Lastly, the script deletes the scanned file.


tell application "PDFpenPro"
	activate
	open "Macintosh HD:Users:Jim:Documents:copier0001.pdf" as alias
	delay 1
	set NumberOfCopies to choose from list {"1", "2", "3", "4", "5", "6", "7", "8", "9", "10"} with title "Number of Copies" with prompt "Enter Number of Copies:"
	
	print front document with properties {copies:NumberOfCopies}
	close front document
	quit
end tell
tell application "Finder" to delete "Macintosh HD:Users:Jim:Documents:copier0001.pdf

 

I don’t think this short script is overly complicated. I tried finding something similar using Google, but didn’t have any luck. As usual with AppleScript, getting the correct syntax is more than 50% of the problem.

10