Re: More questions about scripting iPhoto
Re: More questions about scripting iPhoto
- Subject: Re: More questions about scripting iPhoto
- From: "Mark J. Reed" <email@hidden>
- Date: Tue, 26 Feb 2008 08:55:25 -0500
On Mon, Feb 25, 2008 at 11:11 PM, Mark J. Reed <email@hidden> wrote:
> set desiredTagName to "chase" -- change as desired
> tell application "iPhoto"
> set desiredTag to false
> repeat with tag in keywords
> if tag's name is desiredTagName then
> set desiredTag to tag
> exit repeat
> end if
> end repeat
It occurs to me belatedly that you can replace the above repeat loop
with another whose clause:
set desiredTagList to every keyword whose name is desiredTagName
which gives you a list that you can use thus:
if count(desiredTagList) is 0 then
set taggedPhotos to {}
else
set desiredTag to item 1 of desiredTagList
set taggedPhotos to every photo whose keywords contain desiredTag
end if
(Note that AS lets you say 'contain' instead of 'contains', to make
expressions with plural property names grammatically correct...
something else I overlooked last night.)
The most important thing to note here is that keywords are application
objects, not just strings, so you can't use the "every photo whose
keywords contain" search until you first find the actual keyword
object with the name you seek.
--
Mark J. Reed <email@hidden>
_______________________________________________
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