Created
May 13, 2015 21:37
-
-
Save laingc/c42661365448993572e2 to your computer and use it in GitHub Desktop.
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)
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
-- 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