jwshack

Q: Batch change in Photos?

Seems like Apple has gotten rid of the "batch change" feature from iPhoto when moving to Photos. I liked using the "batch change" feature to change the "description" for several photos at once. Does anyone know how this can be accomplished in the new Photos app (which doesn't include pasting a sentence 200 times)...

 

Thanks for your response!

Posted on Apr 12, 2015 4:37 PM

Close

Q: Batch change in Photos?

  • All replies
  • Helpful answers

first Previous Page 3 of 6 last Next
  • by JWilson@ch,

    JWilson@ch JWilson@ch May 1, 2015 3:34 AM in response to léonie
    Level 1 (0 points)
    May 1, 2015 3:34 AM in response to léonie

    Many thanks Léonie!

    I tried running this script but got an AppleScript error:

     

    error "Photos got an error: AppleEvent handler failed." number -10000

     

    This error is given with the word "date" highlighted in the background in the script, in the line which reads:

     

    set capture_date to (the date of next_image)

     

    Do you have any idea how I could solve this?

  • by Dbrillh,

    Dbrillh Dbrillh May 1, 2015 1:52 PM in response to jwshack
    Level 1 (54 points)
    Safari
    May 1, 2015 1:52 PM in response to jwshack

    I tried this but I just get an error

     

    Screen Shot 2015-05-01 at 3.51.30 PM.png

    and no service shows up in the Photos service menu.

     

    (This is the first animator script that I've tried to do)

  • by léonie,

    léonie léonie May 1, 2015 2:14 PM in response to Dbrillh
    Level 10 (105,761 points)
    iLife
    May 1, 2015 2:14 PM in response to Dbrillh

    Did you select the photos in Photos before you ran the Workflow? Try to select the photos only in one moment or album, and not too many at once. It may be a timing problem.

     

    If the service does not show - did you use the Service template when you created the workflow? Is it in stalled in ~/Library/Services and did you enable it in the System Preferences > Keyboard > Shortcuts ?

    Screen Shot 2015-05-01 at 23.12.16CEST.png

  • by Dbrillh,

    Dbrillh Dbrillh May 1, 2015 3:43 PM in response to léonie
    Level 1 (54 points)
    Safari
    May 1, 2015 3:43 PM in response to léonie

    1) Yes, a couple of photos are selected.

    2) Upon a system restart, the service showed up in the  Photos\ Services menu

    3) I still get the same error. 

    Screen Shot 2015-05-01 at 5.37.31 PM.png

    4) The work flow was created using the Service button on the File/ New action in Automator

    Screen Shot 2015-05-01 at 5.40.09 PM.png

    (I couldn't fine the template that you referenced.)

    5) the "Photos- Description" service does show up and is enabled in keyboard shortcuts/ Service

    Screen Shot 2015-05-01 at 5.41.54 PM.png

     

    Sorry, I may be a little slow at this.  I've programmed various types of computers for 40 some years, but this is the first time I've tried to use Apple Script.

    Thanks.

  • by Dbrillh,

    Dbrillh Dbrillh May 1, 2015 3:57 PM in response to Dbrillh
    Level 1 (54 points)
    Safari
    May 1, 2015 3:57 PM in response to Dbrillh

    it seems like it is saying there is a syntax error at the line:


    set the description to inputset the set Set the description to input

    set the description to inpu

  • by léonie,

    léonie léonie May 1, 2015 4:25 PM in response to Dbrillh
    Level 10 (105,761 points)
    iLife
    May 1, 2015 4:25 PM in response to Dbrillh

    The line you posted looks like it had too many words.

     

    on run {input, parameters}

      -- batch change the description 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 description to input

      end tell

      end repeat

      end if

      end tell

      return input

    end run

     

    It should read:   set the description to input

    all in lower case letters

  • by Dbrillh,

    Dbrillh Dbrillh May 2, 2015 1:14 PM in response to léonie
    Level 1 (54 points)
    Safari
    May 2, 2015 1:14 PM in response to léonie

    that the way the code read, but it still doesn't work.  If you don't  select anything, you do get the error message, so the first part of the script works.  It just gets the event handler error when you select a couple of photos, it's like it's really not able to update the image desriptions.

  • by léonie,

    léonie léonie May 2, 2015 1:26 PM in response to Dbrillh
    Level 10 (105,761 points)
    iLife
    May 2, 2015 1:26 PM in response to Dbrillh

    When you look at the info panel for the photos, did some of the descriptions change or none at all?

  • by Dbrillh,

    Dbrillh Dbrillh May 2, 2015 2:07 PM in response to léonie
    Level 1 (54 points)
    Safari
    May 2, 2015 2:07 PM in response to léonie

    nothing changed.

     

    I saw in another tread that they had said to create the automator script as an application instead of a service.  I tried that with the same code, and it gets an error that way to, but it is a very general error with no specific problems listed.

    Screen Shot 2015-05-02 at 4.04.52 PM.png

  • by Dbrillh,

    Dbrillh Dbrillh May 2, 2015 7:00 PM in response to Dbrillh
    Level 1 (54 points)
    Safari
    May 2, 2015 7:00 PM in response to Dbrillh

    Another user (Ghostborg) suggested that the event handler error was related to Photos library size, and sure enough, the script service works on a smaller library, at least partially.  It assigned the descriptor to the first 6 or 8 selected photos, so I submitted a bug report to the Photos for Mac feedback site. (at Apple Feedback pages.)

  • by léonie,

    léonie léonie May 3, 2015 2:43 AM in response to Dbrillh
    Level 10 (105,761 points)
    iLife
    May 3, 2015 2:43 AM in response to Dbrillh

    and sure enough, the script service works on a smaller library, at least partially.  It assigned the descriptor to the first 6 or 8 selected photos, so I submitted a bug report to the Photos for Mac feedback site. (at Apple Feedback pages.)

    That suggests a timing error. The timing will depend on the library size.

     

    I hope, the bug report will help and Apple fixes this soon.

     

    How large is the library, that did not work?

    We need batch changing particularly for large libraries; scripting is pretty useless, if it will not work on reasonably sized libraries 

  • by Dbrillh,

    Dbrillh Dbrillh May 3, 2015 7:19 AM in response to léonie
    Level 1 (54 points)
    Safari
    May 3, 2015 7:19 AM in response to léonie

    My main library is about 30,000 photos.  The smaller one is a little over 8,000.

     

    My thoughts exactly, if I didn't have a large library, I wouldn't need scripting!

  • by mkstevo,

    mkstevo mkstevo May 4, 2015 12:51 PM in response to Dbrillh
    Level 1 (5 points)
    May 4, 2015 12:51 PM in response to Dbrillh

    Just a note to say thanks to Leonie, this has helped me no end.

     

    I also wanted to help others, so here is my slightly modified version. The changes I've made are to append an index number to the title (Title - 1, Title - 2, Title - 3, etc..) and to set title, name and description to the 'New' title.

     

    on run {input, parameters}

      -- batch change the description to the input

      set IndexNo to 1

      set NewTitle to input

      tell application "Photos"

      activate

      with timeout of 3000 seconds

      set imageSel to (get selection)

      if imageSel is {} then

      error "Please select some images."

      else

      repeat with im in imageSel

      tell im

      set NewTitle to input & " - " & IndexNo as string

      set the description to NewTitle

      set Title to NewTitle

      set the name of im to NewTitle

      set IndexNo to IndexNo + 1

      end tell

      end repeat

      end if

      end timeout

      end tell

      return input

    end run

     

    Once again all thanks to Leonie.

     

    Oh, and if Photos stays focussed during the renaming operation, it seems to help reduce the scripting errors???

  • by Kevin Horton3,

    Kevin Horton3 Kevin Horton3 Jun 6, 2015 4:00 PM in response to mkstevo
    Level 1 (10 points)
    Jun 6, 2015 4:00 PM in response to mkstevo

    It works for me with a small test library, but not with my normal library which has about 15,000 images.  I did repair the library (hold Command + Option keys when starting Photos), but the error persists.  I tried adding a "delay 1" just prior to "set the description to input", but that made no difference.

     

    Has anyone found a way to make this work on large Photos libraries? 

  • by léonie,

    léonie léonie Jun 6, 2015 4:17 PM in response to Kevin Horton3
    Level 10 (105,761 points)
    iLife
    Jun 6, 2015 4:17 PM in response to Kevin Horton3
    I did repair the library (hold Command + Option keys when starting Photos), but the error persists.  I tried adding a "delay 1"

    The scripting errors are less, when the photos are selected in the "AllPhotos" album, and not in Moments or smart albums - unfortunately.

    One  problem with all the scripts is, that the line "set imageSel to (get selection)" in the Apple Scripts does not work reliably in Photos.  It will give random timeouts and works best in the "All Photos" album. Apple needs to fix this to make scripting more reliable.  The errors are more frequently with iCloud Photo Library enabled. When I first posted the scripts I did not use iCloud Photo Library.

     

    There is a work-around proposed by NicFletcher:  Don't ask for the current selection, but add the photos you want to process to an album with a fixed name.

    • Create an album with a fixed name - mycurrentselection or similar - and add all photos you want to process to this album.
    • Instead of the "get current selection" process the photos in this album.

     

    Here is a sample Apple Script by NicFletcher that uses this method:

    https://discussions.apple.com/message/28087786#28087786

first Previous Page 3 of 6 last Next