EXPORTING


Note: The scripts on this site are provided as is and I am unable to provide any technical assistance. Backup all data before using any script provided by this website.

Using AppleScript, users can automate the process of exporting images out of Aperture.

The export command only handles lists of image versions. Instructing Aperture to export a single image version will produce an error. Be sure to export a list of image versions even if you just want to export a single image.

Click to open example in the Script Editor applicationExport selected images to a user defined directory.

 tell application "Finder"
  set export_dir to (choose folder with prompt "Choose a folder to export into") as alias
 end tell

 tell application "Aperture"
  activate
  set imageSel to selection
  export imageSel using export setting "JPEG - Original Size" to export_dir
 end tell


Aperture allows users to export the original master file or a processed file. Also, Aperture provides the option of exporting a XMP sidecar or exporting the master with embedded IPTC data.

Instead of splitting up all the options the export command has, I decided to give an example that showed them all in as a simplistic manner as I can possibly provide. If you have not already noticed, I like giving my scripts prompts for the user of the script so that I do not have to hard code what I want to do each and every time I run the script. If I want to export masters today and versions tomorrow, there is no need to change the script's code.

Click to open example in the Script Editor applicationThis script allows you to pick any current file and folder naming policy, which project to export from, and you can decide to export versions or master files. Of course some of the export options from a scripting point of view don't make much since but others are worthwhile. For example: selecting a custom version name with counter to name your exported versions isn't very useful when running an export script because you can't provide a custom name like you can through Aperture's export sheet.

 
set proj_name to ""
 tell application "Finder"
  set export_dir to (choose folder with prompt "Choose a folder to export into") as alias
 end tell

 tell application "Aperture"
  activate

  set x to name of every project
  choose from list x with prompt "Select a project"
  set ap_proj to item 1 of result
  set ap_proj to project ap_proj

  set x to name of file naming policies
  choose from list x with prompt "select a file naming policy"
  set file_policy to file naming policy (item 1 of result)

  set x to name of folder naming policies
  choose from list x with prompt "select a folder naming policy"
  set dir_policy to folder naming policy (item 1 of result)

  set export_setting to name of export settings
  set end of export_setting to "Master"
  choose from list export_setting with prompt "Choose a file type preset"
  set setting_name to item 1 of result

  --the above basically allows the user of the script to pick and choose how the export will occur instead of hard coding your export each and every time you use this script

  tell ap_proj
  set theimages to every image version as list --export every image in the project. modify the script to use selections of images if you'd rather export that way
  end tell

  --below handles the case of exporting masters or versions

  if setting_name is "Master" then
  with timeout of 3600 seconds
  export theimages naming files with file_policy naming folders with dir_policy to export_dir metadata sidecar --new to 2.0 is the ability to embed the versions' IPTC data into the master itself. change "sidecar" to "embedded" to do so.
  end timeout

  else
  with timeout of 3600 seconds
  export theimages naming folders with dir_policy using export setting setting_name to export_dir naming files with file_policy
  end timeout
  end if

 end tell