Enable for Commenting--Choosing Multiple Files

I am combining two applescripts in Automator. The first script does two tasks by using the “Batch Processing…” feature in Adobe Acrobat 9 Pro.

  1. Crop hi-res PDF files so the crop marks no longer show.

  2. Turn new file into lo-res file for internet use.

The third task is to make the files “Enabled for Commenting”. Unfortunately, this cannot be done with the “Batch Processing…” feature. I have found this script that works fine as a stand alone but I need it to work without using a prompt.

set thePDFs to choose file with prompt "Select the PDF(s) to enable commenting on" with multiple selections allowed

repeat with aPDF in thePDFs
	tell application "Adobe Acrobat Pro"
		open aPDF
	end tell
	activate application "Adobe Acrobat Pro"
	tell application "System Events"
		tell process "Acrobat"
			click menu item "Enable for Commenting and Analysis in Adobe Reader..." of menu 1 of menu bar item "Comments" of menu bar 1
			click button "Save" of window "Save As"
			if exists sheet 1 of window "Save As" then
				click button "Replace" of sheet 1 of window "Save As"
			end if
		end tell
	end tell
	
	
	tell application "Adobe Acrobat Pro"
		close every document
	end tell
end repeat

Here’s where I am currently at with a version that doesn’t use a prompt.

tell application "Finder"
	set myFolder to "Users:jross:Desktop:Enable:Crop"
	set thePDFs to select every file of myFolder
end tell


repeat with aPDF in thePDFs
	tell application "Adobe Acrobat Pro"
		open aPDF
	end tell
	activate application "Adobe Acrobat Pro"
	tell application "System Events"
		tell process "Acrobat"
			delay 10
			click menu item "Enable for Commenting and Analysis in Adobe Reader..." of menu 1 of menu bar item "Comments" of menu bar 1
			click button "Save" of window "Save As"
			if exists sheet 1 of window "Save As" then
				click button "Replace" of sheet 1 of window "Save As"
			end if
		end tell
	end tell
	tell application "Adobe Acrobat Pro"
		close every document
	end tell
	
end repeat

I get an error:

error “Can’t get every file of "Users:jross:Desktop:Enable:Crop".” number -1728 from every file of “Users:jross:Desktop:Enable:Crop”

Seems that I am having trouble selecting multiple files from a certain location (folder). Any ideas on getting this applescript to work without using a prompt?

I’ve played around with the script a bit more and have found a solution that works for me.

tell application "Finder"
	set my_folder to select folder "Macintosh HD:Users:jross:Desktop:Crop:Enable" as text
	set thePDFs to select (every item of my_folder)
end tell

repeat with aPDF in thePDFs
	tell application "Adobe Acrobat Pro"
		open aPDF
	end tell
	activate application "Adobe Acrobat Pro"
	tell application "System Events"
		tell process "Acrobat"
			delay 10
			click menu item "Enable for Commenting and Analysis in Adobe Reader..." of menu 1 of menu bar item "Comments" of menu bar 1
			click button "Save" of window "Save As"
			if exists sheet 1 of window "Save As" then
				click button "Replace" of sheet 1 of window "Save As"
			end if
		end tell
	end tell
	tell application "Adobe Acrobat Pro"
		close every document
	end tell
	
end repeat

If you are using an Apple computer you can download an Automator service script that I made that will batch process “enable commenting”. It will enable you to select as many (or as few) PDFs as you would like and will automatically “enable commenting” in each PDF. You can view the tutorial and download the Automator Script here:

http://www.youtube.com/watch?v=azRq6vRSVbs

Hope this helps.