Hello everyone! I am new to AppleScript, and I realize it is not easy to find information about it. Is there any equivalent?
Back to the topic, I am using AppleScript to convert Word to PDF
tell application "Microsoft Word"
open file "Macintosh HD:Users:test.docx"
delay 1
tell active document
save as file format format PDF file name "/Users/test.pdf"
end tell
end tell
After several times of normal use, an error occurs for some reason, and it can no longer be used.
set p2Folder to path to documents folder as string
tell application "Microsoft Word"
set currentDoc to open file (p2folder&"test.docx")
delay 1
tell currentDoc
save as file format format PDF file name (p2folder &"test.pdf")
end tell
end tell
It assumes that the original file is stored in a folder with correct permissions ( the Documents folder is one of them) and use a consistent format for the paths to files : the Hfs one.
On my side, I assumed that the save instruction was supposed to be :
save as "format PDF" in file (p2folder &"test.pdf")
Yvan KOENIG running High Sierra 10.13.6 in French (VALLAURIS, France) jeudi 4 juin 2020 17:12:47