Last active
January 5, 2021 10:03
-
-
Save mbierman/a9b597702b67ec75312c427939119ab1 to your computer and use it in GitHub Desktop.
Backup iOS devices
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| tell application "System Events" to tell application process "Finder" | |
| set frontmost to true | |
| choose from list {"Michael’s iPhone", "Michael’s iPad"} with title "What devices do you want to backup?" with multiple selections allowed | |
| set devices to result | |
| repeat with device in devices | |
| -- display alert "looking for: " & device | |
| set notificationTitle to "iOS Backup" | |
| set notificationSubTitle to "Looking for" | |
| set notificationMessage to device | |
| display notification notificationMessage with title notificationTitle subtitle notificationSubTitle | |
| tell front menu bar to tell menu "File" to tell menu item "New Tab" | |
| perform action "AXPress" | |
| end tell | |
| set uis to (first UI element of row of (outline 1 of scroll area 1 of splitter group 1 of front window) as list) | |
| repeat with iter in uis | |
| -- display alert "Checking " & name of iter & " against " & device | |
| if name of iter is equal to ((device as string)) then | |
| set ux to iter | |
| -- display alert "Opening " & device & "/" & name of ux & "..." | |
| tell ux | |
| perform action "AXOpen" | |
| end tell | |
| repeat until exists (button "Back Up Now" of scroll area 1 of group 1 of group 1 of splitter group 1 of splitter group 1 of front window) | |
| delay 0.3 | |
| end repeat | |
| set btn to (button "Back Up Now" of scroll area 1 of group 1 of group 1 of splitter group 1 of splitter group 1 of front window) | |
| repeat until enabled of btn | |
| delay 0.3 | |
| end repeat | |
| click btn | |
| exit repeat | |
| delay 0.3 | |
| -- display alert name of iter | |
| end if | |
| set new to false | |
| -- set ux to "" | |
| end repeat | |
| -- display alert "end repeat" | |
| if new then | |
| display alert "oepn a new window" | |
| tell application "System Events" to tell application process "Finder" | |
| set frontmost to true | |
| tell front menu bar to tell menu "File" to tell menu item "New Tab" | |
| perform action "AXPress" | |
| end tell | |
| end tell | |
| --set new to false | |
| end if | |
| end repeat | |
| end tell |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Back up your iOS devices. You must set the names of the devices to match how they show up in
Locationsin Finder.