applescript
Hi all,
I'm new to this game and if my question is not at the right place I hope you'll excuse me.
The question is about "Pages" and "Applescript"
I have about 500 "Pages" documents in a folder and I need to pass them to .pdf format in order for them to be accessible to everybody.
So I wrote a script that does just that: Finder opens the document and Pages saves it in .pdf. The problem is that Pages doesn't manage to close the original document and give an error message. I've tried "close" alone and "close document", both followed by the name of the document or not, with the same result.
Here is a simplified version of the script.
set chemin_in to "Actes"
tell application "Finder"
count folder chemin_in
set nombre_actes to the result
set boucle to 0
repeat nombre_actes times
set boucle to boucle + 1
set nom_acte to the name of file (boucle) of folder chemin_in
open (document file nom_acte in folder chemin_in)
set chemin_out to "Actes pdf:"
--display alert chemin_out message boucle giving up after 1
tell application "Pages"
save front document in chemin_out & nom_acte as "SLDocumentTypePDF"
activate document nom_acte
close document nom_acte (red color my choice to pinpoint what doesn't work)
end tell
--close Finder window 1
end repeat
end tell
Pages word processor-OTHER, Mac OS X (10.5.8)