Skip to content

Instantly share code, notes, and snippets.

@samdmarshall
Last active August 29, 2015 14:26
Show Gist options
  • Save samdmarshall/1cf9bbbe6e15ab801609 to your computer and use it in GitHub Desktop.
Save samdmarshall/1cf9bbbe6e15ab801609 to your computer and use it in GitHub Desktop.
--# Automator Action <Launch Application "Aperture">
--# Automator Action <Pause "5" "Minutes">
--# Automator Action <Run Applscript>
on run {input, parameters}
tell application "System Events"
tell process "Aperture"
--# make Aperture active
set frontmost to true
--# find out if we need to show the sidebar or not
set windowMenuItemNames to name of menu items of menu "Window" of menu bar 1
if windowMenuItemNames contains "Show Inspector" then
--# making the side-bar visible
keystroke "i"
end if
--# wait for UI
delay 2
--# find out if we need to show the vaults list
if windowMenuItemNames contains "Show Vaults" then
--# making the vaults visible
keystroke "R" using shift down
end if
--# wait for UI
delay 2
--# locate the sidebar
set sidebarTab to tab group 1 of splitter group 1 of window 1
--# making sure the library tab is active
set libraryTab to radio button 1 of sidebarTab
click libraryTab
--# wait for UI
delay 2
# find the "update all vaults" button and press it
set updateAllVaultsButton to item 1 of ((UI elements of sidebarTab) whose description is "Update All Vaults")
click updateAllVaultsButton
--# wait for UI (alert must appear)
delay 5
--# find the alert window
set alertWindow to item 1 of (UI elements whose description is "alert")
--# find the update button to backup the vault
set updateButton to item 1 of ((UI elements of alertWindow) whose name is "Update")
--# press the update button
click updateButton
end tell
end tell
end run
--# Automator Action <Pause "20" "Minutes">
--# Automator Action <Quit Application "Aperture">
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment