I'm new to AppleScript and wanted to export my citations using AppleScript. I found the following but am not sure the structure to change the following to my path folders, can you please provide an example and is this executed in the Script editor?:

tell application "Papers" 
set outFolder to ((path to desktop from user domain) as string) & "PDF Files" 
export ((publication item of every primary file item) as list) as PDF Files to outFolder 
end tell


  • This script would be run within Applications > Utilities > Script Editor.app. Please could you edit your question and expand on what you mean by change the following to my path folders. Feb 6 '16 at 13:06
  • @GrahamMin I wanted to know am I supposed to change this script with an actual file path or just copy this script directly like it is in the script editor? Because when I do that and run the script it does not work.
    – J Paul
    Feb 6 '16 at 13:16
  • Good to hear it worked. Please can you close this question. Feb 6 '16 at 13:32

To better understand the AppleScript, try breaking it down.

Within Script Editor.app run the following:

set outFolder to ((path to desktop from user domain) as string) & "PDF Files"

After running, the Result panel will show the value outFolder is set to. This should be a path to a folder called PDF Files on your Desktop.

Does this folder exist on your Mac? If not, this is probably the cause of the problems you are seeing.

The next line in the AppleScript tells the application Papers to export to that folder. If you have problems with Paper's AppleScript behaviour, do contact the developers; they will be best placed to help you.

Add a Try Block

You can add a try block around your AppleScripts. These will provide better error messages and hopefully catch problems.

Changing the Folder

You can add an interactive folder selection by replacing the set outFolder… line to:

set outFolder to choose folder

Alternatively, change the "PDF Files" to the name of your preferred folder.

  • Can I change the path of the folder? If I have this folder in another directory? Thanks
    – J Paul
    Feb 6 '16 at 13:32
  • Try editing the "PDF File" constant; I have updated the answer. Feb 6 '16 at 13:35

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .