| -- A (somewhat buggy) script to export all albums from Photos.app to a directory | |
| -- Based on the script written by Nic Fletcher (see https://discussions.apple.com/message/28098849#28098849) | |
| set srcParent to "iPhoto Events" -- Folder that album is in | |
| set exportBase to "some:path:" | |
| tell application "Photos" | |
| set albList to name of every container of container srcParent | |
| end tell | |
| repeat with albSource in albList | |
| set folderExists to false | |
| tell application "Finder" | |
| if exists folder (albSource) of container exportBase then | |
| set folderExists to true | |
| else | |
| make new folder at exportBase with properties {name:albSource} | |
| end if | |
| end tell | |
| if not folderExists then | |
| tell application "Photos" | |
| set notExist to false | |
| if srcParent = "" then | |
| if exists container albSource then | |
| set srcContainer to container albSource | |
| else | |
| set notExist to true | |
| end if | |
| else | |
| if exists container albSource of container srcParent then | |
| set srcContainer to container albSource of container srcParent | |
| else | |
| set notExist to true | |
| end if | |
| end if | |
| set exportPath to exportBase & albSource as alias | |
| set myList to every media item in srcContainer | |
| export myList to exportPath | |
| end tell | |
| end if | |
| end repeat |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment