Re: Photos: apply keyword to multiple selection
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