Pages fails in supports of AppleScript export

Originator:yosofun
Number:rdar://30389024 Date Originated:
Status: Resolved:
Product:Pages Product Version:10.2.2, 10.2.3
Classification:Automation Reproducible:
 
Area:
Automation

Summary:
Automation scripts in both AppleScript and Automator Javascript do not seem able to export without encountering issue number 6

This has been a problem since 10.2.2

Steps to Reproduce:
1. Open up AppleScript or set up the automator equivalent. 
2. Open Pages. Open up a file. Save it in path A. 
3. In snippet below, set path A to {REPLACE WITH PATH A} 


on run
	tell application "Pages"
		activate
		set theFolder to "{Replace with A but use : instead of /}"
		set theDocName to name of front document
		set theName to (characters 1 thru -7 of theDocName) as string
		set thePDFPath to ((file of front document as string) & ":" & theName & ".txt")
		export front document to POSIX file thePDFPath as unformatted text
		close front document
	end tell
end run

 

Expected Results:
This error occurs

error "Pages got an error: \"path to a\" could not be interpreted as a file URL." number 6

Actual Results:
Pages should have exported the file as instructed, but seems to have issues accessing the file system when invoked from AppleScript

Version:
10.2.2
10.2.3

Notes:


Configuration:
10.2.1 or earlier

Comments


Please note: Reports posted here will not necessarily be seen by Apple. All problems should be submitted at bugreport.apple.com before they are posted here. Please only post information for Radars that you have filed yourself, and please do not include Apple confidential information in your posts. Thank you!