• 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: More questions about scripting iPhoto
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

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

References: 
 >More questions about scripting iPhoto (From: Chris Glowacki <email@hidden>)
 >Re: More questions about scripting iPhoto (From: "Mark J. Reed" <email@hidden>)

  • Prev by Date: Re: Excel Range Crash
  • Next by Date: script to open Adobe Illustrator (CS3) and replace certain fonts
  • Previous by thread: Re: More questions about scripting iPhoto
  • Next by thread: Re: More questions about scripting iPhoto
  • Index(es):
    • Date
    • Thread