Currently Being Moderated

Script: Batch Change the Titles to a Given String

Currently (April 2015) does Photos not yet support batch changing of titles and descriptions.

 

I wrote two very simply Apple Scripts, that can be used to add a title and a description to several selected photos and run from an automator work flow:

 

This script will prompt for a new title to be applied to all photos and then change the title to the string, with an added number.

For example, if you enter "Birthday", the titles will change to "Birthday_0001", "Birthday_0002", etc. The number of digits is a parameter in the script.

 

A copy of this service is in my Dropbox: https://www.dropbox.com/sh/29exskbyuuffk5h/AAA-CDQ1fonab-TxSjvQBG-Ca?dl=0

 

 

on run {input, parameters}

  -- batch change the title to the input

 

  set n_digits to 4 -- how many digits for the appended number

  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

       set ntext to the counter as text

       repeat while (the length of ntext < n_digits) -- add leading zeros

         set ntext to "0" & ntext

      end repeat

 

 

     tell im

       set the name to input & "-" & ntext 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

 

Screen Shot 2015-04-19 at 19.11.34BST.png

Launch Automator,

  • create a new service,
  • drag a "Ask for Text" action into the workflow.
  • drag a "Run Apple Script" action into the workflow.

Copy and paste the text above into the "Run Apple Script" action to replace the default text in the action.

 

Save this workflow with a suitable name.  It will be installed in the services.

 

  • Now quit Photos, if it is running and launch Photos again and select a few test images.
  • Open the "Photos" Menu > Services".
  • The service should be shown in the menu - I saved  my version as "BatchChangeTitles".
  • Select the service to let it run.
  • You will be prompted to enter a new title for the selected photos.
  • When you click the selected photos again, the titles should change.

 

Or simply run the service from the Automator window by pressing the "Run" button after selecting the images.

Replies

Delete User Tip

Are you sure you want to delete this user tip?