Getting Acrobat to Print

Greetings!

I’ve been working on a folder action script that should open/print a pdf that’s dropped into it without interaction. I’ve research Adobe & Acrobat and the forums here and I know what the code should look like and what the Acrobat dictionary has in it but the darn thing just won’t work!?! :mad:
When the script runs it generates an error:

Here’s the code:

on adding folder items to printPreflight after receiving listToPrint
	tell application "Finder"
		repeat with currentItem in listToPrint
			set fileName to name of currentItem
			set pathName to printPreflightName & fileName
			if fileName ends with ".pdf" then
				tell application "Adobe Acrobat Professional"
					activate
					open pathName   -- put this in to see if document had to be open for print pages to work
					-- line below has been tried with & without the various qualifiers
					print pages document fileName first 1 last 1 PS Level 1 with binary output and shrink to fit
					-- have also tried the following variaton
					-- print pages document pathName	-- with & without the qualifiers
					quit saving ask
				end tell
			end if
		end repeat
	end tell
end adding folder items to

The ‘print pages’ command is from the Acrobat Viewer Suite section of the dictionary. I’ve tried other commands from there and can’t get them to work either. Commands from the Required & Core Suites seem to work ok but they don’t have the functionality of the commands in the Acrobat Viewer Suite, in particular the ability to print w/o displaying a modal Print dialog box.
Any help, thoughts, etc would be greatly appreciated!! :slight_smile:

Model: MacBook Pro
AppleScript: 1.10.7
Browser: Internet Explorer 7.0
Operating System: Mac OS X (10.4)

Hi,

the script cannot work, because printPreflightName isn’t defined.
Folder actions don’t generate error messages and abort silently

try this


on adding folder items to printPreflight after receiving listToPrint
	repeat with currentItem in listToPrint
		set fileName to name of (info for currentItem)
		if fileName ends with ".pdf" then
			tell application "Adobe Acrobat Professional"
				activate
				open currentItem -- put this in to see if document had to be open for print pages to work
				-- line below has been tried with & without the various qualifiers
				print pages document 1 first 1 last 1 PS Level 1 with binary output and shrink to fit
				-- have also tried the following variaton
				-- print pages document pathName	-- with & without the qualifiers
				quit saving ask
			end tell
		end if
	end repeat
end adding folder items to

if it doesn’t work either change this line, I don’t know, whether Acrobat opens an alias or a string path

open (currentItem as text) -- put this in to see if document had to be open for print pages to work

Sorry… my bad, forgot the first line in my code:

property printPreflightName : "Public:testfolderaction:"

I got the error message by running just the tell application “Adobe Acrobat Professional” part

tell application "Adobe Acrobat Professional"
	activate
	open "Public:testfolderaction:DetailsClassDisplay.pdf"   -- put in actual name/path of file
	-- line below has been tried with & without the various qualifiers
	print pages document "Public:testfolderaction:DetailsClassDisplay.pdf" first 1 last 1 PS Level 1 with binary output and shrink to fit
end tell

Tried the code you suggested:

open (currentItem as text)

didn’t make any difference. The document opens fine with or without ‘as text’ added.
If I use the ‘Print’ command from Acrobat’s Required Suite it works but presents the Print dialog., then someone has to click OK which I want to avoid.
Doesn’t make sense (at least to me…) that the Required & Core Suites work but not the Adobe Viewer Suites. Could something be missing or corrupt?