Looks like no one’s replied in a while. To start the conversation again, simply ask a new question.

Is there a way to do batch changes in Photos (like we could in iPhoto)?

I made heavy use of the Batch change command in iPhoto.

Now that I'm in Photos, how can I get the same results?

Specifically the Batch change of title....

Mac Pro, OS X Yosemite (10.10.3)

Posted on Apr 11, 2015 9:47 PM

Reply
87 replies

Apr 15, 2015 8:52 AM in response to léonie

Hello,

I followed exactly what you did. I am trying to batch change and append a number to each photo but I keep receiving this error in Photos.


User uploaded file


User uploaded file

This is my input in the AppleScript.


tell application "Photos"

activate

set imageSel to (get selection) -- get a list of selected images

set counter to 1

set currentfilename to ""

if imageSel is {} then

error "Please select an image."

else

repeat with im in imageSel

set title to the name of im

if not (exists (title)) then

set currentfilename to the filename of im as text -- retrieve the filename of image "Im"

set newname to currentfilename & "." & counter

set counter to counter + 1 -- increment the counter

set the name of im to newname -- write the newname to the title field

end if

end repeat

end if

return currentfilename -- return the filename of the last image

end tell

Question marked as Helpful

Apr 15, 2015 11:49 AM in response to Grumpy4u

Grumpy4u wrote:

Where can I see the allowed/defined properties of an image?

In the Applescript dictionary for Photos. You can access that through Script Editor (in your Utilities folder). Open Script Editor & from the File menu, choose "Open Dictionary..." then navigate to Photos in your Applications folder & choose it.


Look for the entry in the dictionary for media item (the object type for photos & videos) -- it is part of the Photos Suite. It will look like this, but with better formatting:


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

elements

contained by application, albums, moments.

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.

location (list of real, r/o) : The GPS latitude and longitude, in an ordered list of 2 numbers. Latitude in range -90.0 to 90.0, longitude in range -180.0 to 180.0.

responds to

duplicate.

Apr 15, 2015 11:05 PM in response to Grumpy4u

The problem is, that your script is a mixture of two scripts -

  • the first script I posted to set the title for all selected images to the same text
  • and the second script to set the title to a filename plus title in answer to OT's question

and the mixture ha undefined variables.


If you want a script to ask for a new image title for all images, but append a number, do this:

https://www.dropbox.com/sh/29exskbyuuffk5h/AAA-CDQ1fonab-TxSjvQBG-Ca?dl=0 (dropbox)


User uploaded file

on run {input, parameters}

-- batch chnage the title to the input

tell application "Photos"

activate

set counter to 1

set imageSel to (get selection) -- get selected images

if imageSel is {} then

error "Please select some images."

else

repeat with im in imageSel

tell im

set the name to input & "_" & counter as text

-- set the title to the input plus number

set counter to counter + 1

end tell

end repeat

end if

end tell

return input

end run

Is there a way to do batch changes in Photos (like we could in iPhoto)?

Welcome to Apple Support Community
A forum where Apple customers help each other with their products. Get started with your Apple ID.