Grumpy4u

Q: 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

Close

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

  • All replies
  • Helpful answers

Page 1 of 6 last Next
  • by Terence Devlin,Solvedanswer

    Terence Devlin Terence Devlin Apr 12, 2015 12:35 AM in response to Grumpy4u
    Level 10 (139,475 points)
    iLife
    Apr 12, 2015 12:35 AM in response to Grumpy4u

    You can't.

     

    http://www.apple.com/feedback/macosx.html is the place for feature requests and feedback

  • by léonie,

    léonie léonie Apr 12, 2015 8:10 AM in response to Grumpy4u
    Level 10 (105,543 points)
    iLife
    Apr 12, 2015 8:10 AM in response to Grumpy4u

    To batch change the titles of selected photos to the same title you could try a simple Apple Script and run it with Automator.

    Create an Automator action, that prompts you for the new title and executes an Apple Script to change the titles to the name you entered:

    I put a copy of the finished workflow into my Dropbox, if you want to try it:  https://www.dropbox.com/sh/r6kf61oiktntt3q/AADJtXaEuB38OZY0H0PWEIPfa?dl=0

     

    The Apple Script:

     

    on run {input, parameters}

      -- batch chnage the title to the input

      tell application "Photos"

      activate

      set imageSel to (get selection)

      if imageSel is {} then

      error "Please select some images."

      else

      repeat with im in imageSel

      tell im

      set the name to input

      end tell

      end repeat

      end if

      end tell

      return input

    end run

     

    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.

     

    Screen Shot 2015-04-12 at 17.02.08CEST.png

    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.
  • by léonie,Helpful

    léonie léonie Apr 13, 2015 2:02 PM in response to léonie
    Level 10 (105,543 points)
    iLife
    Apr 13, 2015 2:02 PM in response to léonie

    .

  • by Old Toad,

    Old Toad Old Toad Apr 13, 2015 11:04 AM in response to léonie
    Level 10 (140,898 points)
    Photos for Mac
    Apr 13, 2015 11:04 AM in response to léonie

    How would you modify the script to put a sequential number at the end, i.e. - 001, - 002, etc.?

     

    And to get the file name and use it?

  • by léonie,

    léonie léonie Apr 13, 2015 2:29 PM in response to Old Toad
    Level 10 (105,543 points)
    iLife
    Apr 13, 2015 2:29 PM in response to Old Toad

    Like this:

     

    I'd add a variable "counter" that will be incremented for each new file.  then append this counter to the filename (the "&" operator appends strings and converts numbers to strings)

     

    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

     

    The spellchecker is continually corrupting the code I hope, I found all "corrections"

  • by Old Toad,

    Old Toad Old Toad Apr 13, 2015 2:36 PM in response to léonie
    Level 10 (140,898 points)
    Photos for Mac
    Apr 13, 2015 2:36 PM in response to léonie

    léonie:

     

    I get this error when running the script:

    error "The variable newsman is not defined." number -2753 from "newsman"

    What is newsman

     

    Yes, that spellchecker can do make some awful messes at times.

  • by léonie,

    léonie léonie Apr 13, 2015 2:46 PM in response to Old Toad
    Level 10 (105,543 points)
    iLife
    Apr 13, 2015 2:46 PM in response to Old Toad

    I put a link to the original source in my Dropbox:

     

    https://www.dropbox.com/s/a0qj8znhoan0pn1/filename2titlewithnumber.scpt?dl=0

     

    the newsman was not the worst! The spellchecker changed all variable names and changed the name "im"  to "I'm"

  • by Old Toad,

    Old Toad Old Toad Apr 13, 2015 2:55 PM in response to léonie
    Level 10 (140,898 points)
    Photos for Mac
    Apr 13, 2015 2:55 PM in response to léonie

    That took care of the error and adds the file name to the Title field.  If there's already a title showing it will not replace it.

     

    Thanks so much. 

  • by Grumpy4u,

    Grumpy4u Grumpy4u Apr 13, 2015 3:28 PM in response to léonie
    Level 1 (4 points)
    iLife
    Apr 13, 2015 3:28 PM in response to léonie

    Followed you fine, except that the service does not show in Photos...

     

    Screen Shot 2015-04-13 at 3.27.30 PM.jpg

  • by Old Toad,

    Old Toad Old Toad Apr 13, 2015 3:35 PM in response to Grumpy4u
    Level 10 (140,898 points)
    Photos for Mac
    Apr 13, 2015 3:35 PM in response to Grumpy4u

    It didn't for me either so I had Automator or Applescript create an application which I put in the Scripts folder that is accessible from the menu bar.

    Safari001.jpg

     

    Works as advertised this way.

  • by léonie,

    léonie léonie Apr 13, 2015 3:37 PM in response to Grumpy4u
    Level 10 (105,543 points)
    iLife
    Apr 13, 2015 3:37 PM in response to Grumpy4u

    Did you check, if it installed  in your user library in the Services folder?

    ~/Library/Services/BatchChangeTitles.workflow

     

    Once installed, restart Photos.  You may need to restart the system as well.

     

    Does the service run, when you launch it from Automator?

     

    Check the header in Automator.

    Screen Shot 2015-04-14 at 00.35.26CEST.png

  • by léonie,

    léonie léonie Apr 13, 2015 3:42 PM in response to Old Toad
    Level 10 (105,543 points)
    iLife
    Apr 13, 2015 3:42 PM in response to Old Toad

    Works as advertised this way.

    I see you have already a nice collection!

     

    Perhaps I should make a Photos version of my Aperture  script, that sets the time of all selected selected photos to the same date, and increments it by a fixed step for each photo, like iPhotos batch change time does.  I use that script mainly for scanned slides.

  • by Grumpy4u,

    Grumpy4u Grumpy4u Apr 13, 2015 5:52 PM in response to léonie
    Level 1 (4 points)
    iLife
    Apr 13, 2015 5:52 PM in response to léonie

    Screen Shot 2015-04-13 at 5.51.12 PM.jpgRestarting the system was required.

    Now I see the service, but I'm getting an error.

    Code:

     

    -- batch change the title to the input

        tell application "Photos"

    activate
    set counter to 1
    set imageSel to (get selection) -- get a list of selected images
    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 newname to input & "." & counter
    set counter to counter + 1 -- increment the counter
    set the name of im to newname -- write the new title field
    -- end if
    end repeat
    end if

        end tell

        return input

    end run

    Screen Shot 2015-04-13 at 5.38.00 PM.jpg

    What line is in error?

    Screen Shot 2015-04-13 at 5.51.12 PM.jpg

  • by léonie,

    léonie léonie Apr 14, 2015 9:02 AM in response to Grumpy4u
    Level 10 (105,543 points)
    iLife
    Apr 14, 2015 9:02 AM in response to Grumpy4u

    In the fragment, that you posted the first line "on run {input, parameters}"  is missing, so the variable "input" in the last line "return input" is undefined.

     

    What are you trying to do?

     

    That looks now like a mixture of the first script I posted, to change the title to  string, that is read from a user input,

    and the second script, that I posted in answer to old Toad's question about setting the title to the filename.

     

    Which of the two batch changes do you want to do?

Page 1 of 6 last Next