How to get Hazel have Adobe Acrobat save as reduced size PDF

Get help. Get answers. Let others lend you a hand.

Moderator: Mr_Noodle

I am new to Hazel and know next to nothing about AppleScript. I recently learned about Hazel from David Sparks' book Paperless. That recommendation alone was worth the price of the book. And I said to him in an email Hazel is the most useful piece of software I've ever purchased In some 20+ years of computer usage) at ANY price).

I'm sure there's more I can do but for now the thing I am using Hazel for (and the reason i purchased it) was to move scanned PDFs to the appropriate client folder after scanning. (There might be another way to do it, but I am creating rules for each client to move the file into the appropriate directory based on the client's name (which is part of the file name.)

Anyway, I would like to have Hazel have Adobe Acrobat run the "save as reduced size PDF" command before moving the file to the client's (sub)directory.

I have pasted some script that I found on the MacScripter web site (http://macscripter.net/) into the Hazel rule but I am running into a problem. For one, there might be a problem in that the script that I found is for Acrobat 9 and I am using X (10). Also, I'm sure that I am supposed to add or subtract something from the script in order to get it to run within Hazel (rather than free-standing).

Anyway, here's the script that I found at MacSripter (at http://macscripter.net/viewtopic.php?id=20666&p=20):

set theFolder to choose folder
tell application "Finder" to set theFiles to entire contents of theFolder

activate application "Adobe Acrobat Professional"

repeat with aFile in theFiles
tell application "Adobe Acrobat Professional" to open (aFile as Unicode text)

tell application "System Events"
tell process "Acrobat"
delay 1
click menu item "Reduce File Size..." of menu 1 of menu bar item "Document" of menu bar 1
delay 1
click button "OK" of window "Reduce File Size"
delay 2
click button "Save" of window "Save As"
delay 1
click button "Replace" of sheet 1 of window "Save As"
delay 15
-- handle any conversion errors
try
click button "OK" of window "Conversion Warnings"
end try
end tell
end tell
tell application "Adobe Acrobat Professional" to close all docs saving "No"
end repeat

So, the two things I need to know are how to modify this to work with Acrobat X and what I need to add or subtract before pasting ti into my Hazel rule.

I apologize for my lack of Hazel and Applescript knowledge and for the length of this post.

Thanks.

An addition - In messing around with the script i did figure out that I need to put "theFile" somewhere there in the beginning (as the instructions say) to get Acrobat to act on the file being processed.
bwmartin
 
Posts: 1
Joined: Wed Oct 03, 2012 4:17 pm

First off, I recommend putting things like scripts within [code] tags. Makes it much more readable.

I think the main two changes to make it work in Hazel are:
- Get rid of the "repeat...end repeat"
- Change "aFile" to "theFile"

Issues with Acrobat itself are beyond the support I can give and I suggest asking at the site where you got the script.
Mr_Noodle
Site Admin
 
Posts: 11865
Joined: Sun Sep 03, 2006 1:30 am
Location: New York City


Return to Support