Skip to content

Instantly share code, notes, and snippets.

@MrMage
Created November 29, 2017 20:50
Show Gist options
  • Save MrMage/d97a093332c68bdd0601ff160cf30d0b to your computer and use it in GitHub Desktop.
Save MrMage/d97a093332c68bdd0601ff160cf30d0b to your computer and use it in GitHub Desktop.
JXA (JavaScript for Automation) to add photos with a specific filename to a Photos album
var photos = Application("Photos");
var al = photos.albums.whose({ name: 'ALBUM_NAME' })[0].get();
photos.add([photos.mediaItems.whose({ filename: 'FILE_NAME.jpg' })[0].get()], { to: al });
// ...
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment