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
you should use Automator (in the Applications folder) for this kind of task, it's very easier.
;-)
abracadabraPDF.net