Hello Stan
You may fasten a bit your script if you drop the use of an index in the loop.
set newKeywords to {"Wedding"} -- list may contain multiple keywords tell application id "com.apple.Photos" set selectedPhotos to selection repeat with aPhoto in selectedPhotos tell aPhoto try set keywords to keywords & newKeywords on error number -1700 -- photo has no keywords set keywords to newKeywords end try end tell end repeat end tell
Behave flawlessly.
This alternate version works well too.
set newKeywords to {"Wedding"} -- list may contain multiple keywords tell application id "com.apple.Photos" set selectedPhotos to selection repeat with aPhoto in selectedPhotos tell aPhoto if its keywords is missing value then set keywords to newKeywords else set keywords to keywords & newKeywords end if end tell end repeat end tell
I'm not sure of which one is the faster.
Yvan KOENIG running El Capitan 10.11.4 in French (VALLAURIS, France) mardi 10 mai 2016 19:02:35
|