These forums are now Read Only. If you have an Acrobat question, ask questions and get help from one of our experts.

Acrobat - batch convert using Applescript - ..."Adobe Acrobat Pro got an error: document 1 doesn't understand the save message."

mattm
Registered: Jun 9 2011
Posts: 2

Hi, hoping someone can help with this...just at my wits end with this.
 
I have a series of .png files that represent individual pages of a group of multi-page files (in this case, sheet music). Each file is numbered sequentially, e.g. first_song01.png, first_song02.png, first_song03.png, second_song01.png, and so on). I have written as script to open all the files of each song's .png files in Acrobat Pro 9 for Mac OS 10.6 at a time.
 
That automatically causes Acrobat to ask if I want to group all these similarly numbered files in a single document. I've got it UI-scripted to click "yes," and Acrobat opens the files into one document.
 
Next, I see a dialogue asking me to name the file. No problems up until this point.
 
Now, it falls apart. I have been trying to get Acrobat to save this newly created document to a particular folder (specified earlier in the script during runtime) with the filename provided in the previous step.
 
Script looks like this:
 
tell application "Adobe Acrobat Pro"
tell document 1
set theNewFileName to (text returned of ((display dialog "Enter the File Name." default answer theSuffix with title "Enter File Name" buttons {"Cancel", "OK"} default button "OK" cancel button "Cancel" with icon note)) & ".pdf") as string
log "theNewFileName: " & theNewFileName
set theNewFilePath to targetFolder & theNewFileName
log "theNewFilePath: " & theNewFilePath
end tell
end tell
  
tell application "Adobe Acrobat Pro"
save front document to alias theNewFilePath
close front document saving no
end tell
 
I have been fiddling and fiddling with this, to no avail. I keep getting the same error:
 
Adobe Acrobat Pro got an error: document 1 doesn't understand the save message." number-1708 from document 1
 
I assumed this had something to do with the alias being properly defined, but I've included a log entry just above this code where it confirms that points to something like the following:
 
log theNewFilePath: Hard Drive:Exports:Scans:first_song.pdf
 
Following that, the Applescript editor shows the result of the attempted save command:
 
save document 1 to alias {alias "Hard Drive:Exports:Scans:", "first_song.pdf"}
error number -1708
 
Any idea what I'm missing here? This is making me nuts and I'm really out of ideas.
 
Thanks for help in advance,
Matt

My Product Information:
Acrobat Pro 9.4.3, Macintosh
Merlin
Acrobat 9ExpertTeam
Registered: Mar 1 2006
Posts: 766
Hi,

you should use Automator (in the Applications folder) for this kind of task, it's very easier.

;-)
mattm
Registered: Jun 9 2011
Posts: 2
Thanks, I'll check that out, but given that I have further post-processing down the line after this step that needs to be done in Acrobat, I'd still like to solve this. Any idea what the correct syntax should be to make this work?

Matt

macgrunt
Registered: Jul 7 2011
Posts: 1
Hi Matt

Not sure if you got this working in the end

This works for me (but I'm using Acrobat Pro 9 on Mac OSX 10.5.8) :


set theSuffix to "name"
set targetFolder to ":Users:Design:Desktop:untitled folder:" as alias

tell application "Adobe Acrobat Pro"
tell document 1
set theNewFileName to (text returned of ((display dialog "Enter the File Name." default answer theSuffix with title "Enter File Name" buttons {"Cancel", "OK"} default button "OK" cancel button "Cancel" with icon note)) & ".pdf") as string
save to file ((targetFolder as string) & theNewFileName as string)
end tell
end tell


Have a good one

m.