• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: Photos: apply keyword to multiple selection
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Photos: apply keyword to multiple selection


  • Subject: Re: Photos: apply keyword to multiple selection
  • From: "Schmidt, Michael" <email@hidden>
  • Date: Tue, 10 May 2016 15:31:35 +0000
  • Thread-topic: Photos: apply keyword to multiple selection

Hi, Phil,
This works, but slowly…

set myList to {}

set newKeyword to "Wedding"


tell application id "com.apple.Photos"

set selectedPhotos to selection

repeat with aMediaItem in selectedPhotos

try

set theKeywords to keywords of aMediaItem

if newKeyword is not in theKeywords then

set end of theKeywords to newKeyword

set keywords of aMediaItem to theKeywords

end if

on error errstr

log errstr

end try

end repeat

end tell


Have a nice day,
Michael




Hmm, does anyone know how this might be done?

I see from the dictionary that ‘keywords’ are not r/o, and the wording (“to associate”) suggests they should be writable:

keywords (list of text) : A list of keywords to associate with a media item

However, I’m having difficulty figuring out the syntax. If I get my selection like this:


setmyListto {}
tellapplicationid "com.apple.Photos"
repeatwith ifrom 1 to countof selection
setend of myListto filenameof itemiof (get selection)
endrepeat
endtell


What verb/command should I use to add a new keyword like “Wedding” to the keywords list of every item in the entire selection?


TIA


Best


Phil
 _______________________________________________
Do not post admin requests to the list. They will be ignored.
AppleScript-Users mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:
Archives: http://lists.apple.com/archives/applescript-users

This email sent to email@hidden

References: 
 >Photos: apply keyword to multiple selection (From: 2551phil <email@hidden>)

  • Prev by Date: Photos: apply keyword to multiple selection
  • Next by Date: Re: Photos: apply keyword to multiple selection
  • Previous by thread: Photos: apply keyword to multiple selection
  • Next by thread: Re: Photos: apply keyword to multiple selection
  • Index(es):
    • Date
    • Thread