AppleScript Export not functional due to Sandbox restrictions

Originator:bruno
Number:rdar://30346326 Date Originated:2017-02-03
Status:Closed Resolved:Duplicate
Product:macOS + SDK Product Version:Version 10.12.2 (16C67)
Classification:Automation Reproducible:Always
 
The AppleScript Pages command 'export' appears to be not functional, due to Sandbox restriction. 

While this makes sense to prevent malicious scripts from adding or overwriting any files, it also seriously inhibits any Automator workflows that would make use of the `export` command (or other commands that write to the file system).

Having a reliable workaround would greatly improve matters.

Steps to Reproduce:
1. Open attached workflow.
2. Add a .pages document to the 'Get specified finder item' step at the top.
3. Run the workflow

Expected Results:
A PDF file with the same name appears in the same directory as the .pages file.

Actual Results:
Workflow stops with the following error;

> Pages got an error: The document “test” could not be exported as “test”. You don’t have permission.

Version:
Version 10.12.2 (16C67)

Notes:
Various other ways of specifying the `_location` for the export did not yield any better results. For example, converting it to POSIX just gave other errors.

For more information, see the following StackExchange question; http://apple.stackexchange.com/q/269539/44633

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!