pkmusic

Q: Keyword is blank missing?

In iPhoto, there was a handy feature to capture images lacking keywords by creating a Smart Album with the filter "Keyword is blank". This would allow me to find images not being grouped correctly. I can't find this in Photos. To achieve the same thing, I have to add about 30 filters. It's really annoying. Is there a way around this? Am I missing something? If it's missing, why? Thanks for your time - it's much appreciated.

Posted on Jun 12, 2016 11:04 PM

Close

Q: Keyword is blank missing?

  • All replies
  • Helpful answers

  • by léonie,Solvedanswer

    léonie léonie Jun 12, 2016 11:39 PM in response to pkmusic
    Level 10 (105,249 points)
    iLife
    Jun 12, 2016 11:39 PM in response to pkmusic

    This essential feature is missing in Photos.

     

    You may want to send feedback to Apple with a feature request. The feedback form is here:

    Feedback - Photos - Apple

     

    You could search for photos without keywords using an Apple Script and collect these photos in a standard album, if you can write Apple Script.

  • by pkmusic,

    pkmusic pkmusic Jun 13, 2016 3:16 AM in response to léonie
    Level 1 (99 points)
    Photos for Mac
    Jun 13, 2016 3:16 AM in response to léonie

    Thanks very much. I have sent that request.

  • by léonie,

    léonie léonie Jun 13, 2016 4:15 AM in response to pkmusic
    Level 10 (105,249 points)
    iLife
    Jun 13, 2016 4:15 AM in response to pkmusic

    You're welcome.

    I put a script into my Dropbox:

    https://dl.dropboxusercontent.com/u/45503699/Photos_find_photos_with_no_keywords .scpt

     

    To use it, uncompress it and open it in Script Editor.

     

    Select the photos in Photos you want to scan for keywords - for a first try not too many.

    Then press the Run button in Script Editor.

     

    The script should collect all photos without keywords in a new album named "missingKeywordsAlbum".

     

    (* select a some photos to check for missing keyword.

    The photos will be collected in an album named "missingKeywordsAlbum" *)

     

    set ReadFromAlbum to false

     

    -- set this to true, if you want to pass the photos in a toplevel album

    set theAlbumName to "PhotoDropBox" -- change this to the name of the album you will use

     

     

    set imageSel to {}

    set saved_delimiter to AppleScript's text item delimiters --save the delimiter

    set missingalbumname to "missingKeywordsAlbum"

     

    tell application "Photos"

      activate

      if (ReadFromAlbum) then -- the photos will be passed in a toplevel album named "PhotoDropBox"

     

      try

     

      if exists container theAlbumName then

     

      set thePhotosBuffer to container theAlbumName

      set imageSel to every media item of thePhotosBuffer

      else

      error "Album " & theAlbumName & "does not exist"

      end if

     

      on error errTexttwo number errNumtwo

      display dialog "Cannot open album: " & errNumtwo & return & errTexttwo

      end try

     

      else -- process the selected photos from the All Photos album

      try

      set imageSel to (get selection)

      on error errTexttwo number errNumtwo

      display dialog "Cannot get the selection: " & errNumtwo & return & errTexttwo

      end try

     

      end if

     

      -- check, if the album or the selected photos do contain images

      if imageSel is {} then

      error "Please select some images."

      else -- create an album for the photos without keywords

      try

     

      if exists container missingalbumname then

     

      set theMissingAlbum to container missingalbumname

      else

      set kwa to (make new album named missingalbumname)

      end if

     

      on error errTexttwo number errNumtwo

      display dialog "Cannot open album missingKeywordsAlbum: " & errNumtwo & return & errTexttwo

      end try

     

      repeat with im in imageSel

     

      try

     

      tell im

      --set the text item delimiter

      set AppleScript's text item delimiters to {", "} --use a comma and space as the delimiter

      -- retrieve the keywords

     

      set kws to its keywords as string

      if (not (exists kws) or (kws is "missing value")) then

      add {im} to kwa

      end if

     

      end tell

      on error errText number errNum

      display dialog "Error: " & errNum & return & errText & "Trying again"

      try

      delay 2 -- wait and try again

      tell im

      --set the text item delimiter

      set AppleScript's text item delimiters to {", "} --use a comma and space as the delimiter

      -- retrieve the keywords

     

      set kws to its keywords as string

      if (not (exists kws) or (kws is "missing value")) then

      add {im} to kwa

      end if

     

      end tell

      on error errTexttwo number errNumtwo

      display dialog "Skipping image due to repeated error: " & errNumtwo & return & errTexttwo

      end try

      end try

      end repeat

      end if

    end tell

    -- display dialog "Done"

    set AppleScript's text item delimiters to saved_delimiter --restore  the delimiter

     

    return "Done"

  • by léonie,

    léonie léonie Jun 13, 2016 7:02 AM in response to léonie
    Level 10 (105,249 points)
    iLife
    Jun 13, 2016 7:02 AM in response to léonie

    I found the first bug - the previous version gives an error if the album does not exist. The updated version is here:  https://dl.dropboxusercontent.com/u/45503699/Photos_find_photos_with_no_keywords .scpt

     

    (* Find All Photos Without Keywords   © Léonie

      --------------------------------

     

    This script will scan the photos passed to it for keywords and add  all photos without keywords to a standard album called missingKeywordsAlbum

     

    To use this script, select a some photos in Photos to check for missing keyword.

    Then press the "Run" button.

     

     

    The photos can be passed to the script in two ways:

    1. Either select photos while viewing the  "All Photos" album; this works better than Moments or smart albums

    2. Or collect the Photos in a top level defined album with a fixed name. This is safer when your Photos Library is an iCloud Photo Library.

     

    If you want to select the photos without collecting them in an album, set the variable "ReadFromAlbum" to false

    If you want to pass the photos in a toplevel album, set ReadFromAlbum to true and change the variable "theAlbumName" to the name of the album you are using.

     

    *)

     

    set ReadFromAlbum to false

     

    -- set this to true, if you want to pass the photos in a toplevel album

    set theAlbumName to "PhotoDropBox" -- change this to the name of the album you will use

     

     

    set imageSel to {}

    set saved_delimiter to AppleScript's text item delimiters --save the delimiter

    set missingalbumname to "missingKeywordsAlbum"

     

    tell application "Photos"

      activate

      if (ReadFromAlbum) then -- the photos will be passed in a toplevel album named "PhotoDropBox"

     

      try

     

      if exists container theAlbumName then

     

      set thePhotosBuffer to container theAlbumName

      set imageSel to every media item of thePhotosBuffer

      else

      error "Album " & theAlbumName & "does not exist"

      end if

     

      on error errTexttwo number errNumtwo

      display dialog "Cannot open album: " & errNumtwo & return & errTexttwo

      end try

     

      else -- process the selected photos from the All Photos album

      try

      set imageSel to (get selection)

      on error errTexttwo number errNumtwo

      display dialog "Cannot get the selection: " & errNumtwo & return & errTexttwo

      end try

     

      end if

     

      -- check, if the album or the selected photos do contain images

      if imageSel is {} then

      error "Please select some images."

      else -- create an album for the photos without keywords

      try

     

      if exists container missingalbumname then

     

      set kwa to container missingalbumname

      else

      set kwa to (make new album named missingalbumname)

     

      end if

     

      on error errTexttwo number errNumtwo

      display dialog "Cannot open album missingKeywordsAlbum: " & errNumtwo & return & errTexttwo

      end try

     

      repeat with im in imageSel

     

      try

     

      tell im

      --set the text item delimiter

      set AppleScript's text item delimiters to {", "} --use a comma and space as the delimiter

      -- retrieve the keywords

     

      set kws to its keywords as string

      if (not (exists kws) or (kws is "missing value")) then

      add {im} to kwa

      end if

     

      end tell

      on error errText number errNum

      display dialog "Error: " & errNum & return & errText & "Trying again"

      try

      delay 2 -- wait and try again

      tell im

      --set the text item delimiter

      set AppleScript's text item delimiters to {", "} --use a comma and space as the delimiter

      -- retrieve the keywords

     

      set kws to its keywords as string

      if (not (exists kws) or (kws is "missing value")) then

      add {im} to kwa

      end if

     

      end tell

      on error errTexttwo number errNumtwo

      display dialog "Skipping image due to repeated error: " & errNumtwo & return & errTexttwo

      end try

      end try

      end repeat

      end if

    end tell

    -- display dialog "Done"

    set AppleScript's text item delimiters to saved_delimiter --restore  the delimiter

     

    return "Done"

  • by léonie,

    léonie léonie Jun 13, 2016 7:25 AM in response to léonie
    Level 10 (105,249 points)
    iLife
    Jun 13, 2016 7:25 AM in response to léonie

    All further edits will be in this user tip:

       https://discussions.apple.com/docs/DOC-10291