AppleScript+Pages: Export command always fails with permission error
Here is my script:
tell application "Pages"
set thisDoc to open "/Users/fmillion/test.pages"
set docFile to file of thisDoc
log "The file is " & docFile
export thisDoc to "/Users/fmillion/test2.docx" as Microsoft Word
end tell
The script runs, Pages opens and loads the document. However, the Export step fails. Here's the full events output:
tell application "Pages"
open "/Users/fmillion/test.pages"
--> document "test.pages"
get file of document "test.pages"
--> file "Macintosh HD:Users:fmillion:test.pages"
(*The file is Macintosh HD:Users:fmillion:test.pages*)
export document "test.pages" to "Macintosh HD:Users:fmillion:test2.docx" as Microsoft Word
--> error "The document “test.pages” could not be exported as “test2”. You don’t have permission." number 6
Result:
error "Pages got an error: The document “test.pages” could not be exported as “test”. You don’t have permission." number 6
No amount of fiddling with parameters will change this. Obviously, I have write permission to my home directory, which just to be absolutely sure I verified. (I do.) I even tried creating a directory with chmod 777 to give it world-writable state, but Pages still wouldn't export there.
I feel like I'm missing something - could anyone tell me what it is?
Thanks!
F
OS X Mavericks (10.9.2)