Photos 5 AppleScript Dictionary - RhetTbull/PhotoScript GitHub Wiki

Standard Suite Common classes and commands for all applications.

count v : Return the number of elements of a particular class within an object.

count specifier : The objects to be counted.
→ integer : The count.

exists v : Verify that an object exists.

exists any : The object(s) to check.
→ boolean : Did the object(s) exist?

open v : Open a photo library

open file : The photo library to be opened.

quit v : Quit the application.

quit

application n [see also Photos Suite] : The application's top-level scripting object.

PROPERTIES
name (text, r/o) : The name of the application.
frontmost (boolean, r/o) : Is this the active application?
version (text, r/o) : The version number of the application.
RESPONDS TO
open, quit.

Photos Suite Classes and commands for Photos

import v : Import files into the library

import list of file : The list of files to copy.
[ into album] : The album to import into.
[ skip check duplicates boolean] : Skip duplicate checking and import everything,
defaults to false.
→ list of media item : The imported media items in an array

export v : Export media items to the specified location as files

export list of media item : The list of media items to export.
to file : The destination of the export.
[ using originals boolean] : Export the original files if true, otherwise export
rendered jpgs. defaults to false.

duplicate v : Duplicate an object. Only media items can be duplicated

duplicate media item : The media item to duplicate
→ media item : The duplicated media item

make v : Create a new object. Only new albums and folders can be created.

make
new type : The class of the new object, allowed values are album or folder
[ named text] : The name of the new object.
[ at folder] : The parent folder for the new object.
→ album or folder : The new object.

delete v : Delete an object. Only albums and folders can be deleted.

delete album or folder : The album or folder to delete.

add v : Add media items to an album.

add list of media item : The list of media items to add.
to album : The album to add to.

start slideshow v : Display an ad-hoc slide show from a list of media items, an album, or a folder.

start slideshow using list of media item : The media items to show.

stop slideshow v : End the currently-playing slideshow.

stop slideshow

next slide v : Skip to next slide in currently-playing slideshow.

next slide

previous slide v : Skip to previous slide in currently-playing slideshow.

previous slide

pause slideshow v : Pause the currently-playing slideshow.

pause slideshow

resume slideshow v : Resume the currently-playing slideshow.

resume slideshow

spotlight v : Show the image at path in the application, used to show spotlight search results spotlight text, media item, or container : The full path to the image

search v : search for items matching the search string. Identical to entering search text in the Search field in Photos

search for text : The text to search for
→ list of media item : reference(s) to found media item(s)

application n [see also Standard Suite] : The top level scripting object for Photos.

ELEMENTS
contains containers, albums, folders, media items.
PROPERTIES
selection (list of media item, r/o) : The currently selected media items in the
application
favorites album (album, r/o) : Favorited media items album.
slideshow running (boolean, r/o) : Returns true if a slideshow is currently running.
recently deleted album (album, r/o) : The set of recently deleted media items

media item n : A media item, such as a photo or video.

ELEMENTS
contained by application, albums.
PROPERTIES
keywords (list of text) : A list of keywords to associate with a media item
name (text) : The name (title) of the media item.
description (text) : A description of the media item.
favorite (boolean) : Whether the media item has been favorited.
date (date) : The date of the media item
id (text, r/o) : The unique ID of the media item
height (integer, r/o) : The height of the media item in pixels.
width (integer, r/o) : The width of the media item in pixels.
filename (text, r/o) : The name of the file on disk.
altitude (real, r/o) : The GPS altitude in meters.
size (integer) : The selected media item file size.
location (list of real or list of missing value) : The GPS latitude and longitude, in an
ordered list of 2 numbers or missing values. Latitude in range -90.0 to 90.0,
longitude in range -180.0 to 180.0.
RESPONDS TO
duplicate, spotlight.

container n : Base class for collections that contains other items, such as albums and folders

ELEMENTS
contained by application, folders.
PROPERTIES
id (text, r/o) : The unique ID of this container.
name (text) : The name of this container.
parent (folder, r/o) : This container's parent folder, if any.
RESPONDS TO spotlight.

album n [inh. container] : An album. A container that holds media items

ELEMENTS
contains media items; contained by application.

folder n [inh. container] : A folder. A container that holds albums and other folders, but not media items ELEMENTS contains containers, albums, folders; contained by application.