• 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: whose clause with two conditions?
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: whose clause with two conditions?


  • Subject: Re: whose clause with two conditions?
  • From: kai <email@hidden>
  • Date: Fri, 26 May 2006 03:43:06 +0100


On 25 May 2006, at 14:10, Ruth Bygrave wrote:

Something I quite often want to do. I can never seem to get something like...

Since your main question has been answered, Ruth, here are some suggestions for the other situations you mentioned:


('photographs whose date is last month and whose keyword is cats')

When dealing with a date range, you really need to specify two dates: a start date and an end date. You can then apply filters to extract the dates that fall between the two. This should give you an idea of the general principle:


-----------
on iPhoto_date from d
tell d to tell (year * 10000 + (its month) * 100 + day as string) & 1000000 + (its hours) * ¬
10000 + (its minutes) * 100 + (its seconds) to text 1 thru 4 & "-" & text 5 thru 6 & ¬
"-" & text 7 thru 8 & space & text 10 thru 11 & ":" & text 12 thru 13 & ":" & text 14 thru 15
end iPhoto_date


on month_range for d
	if d's class is not date then set d to date ("1 " & d)
	tell d + 32 * days to tell it - 1 - (day - 1) * days to ¬
		{my (iPhoto_date from it - day * days), my (iPhoto_date from it + 1)}
end month_range

set {prev_month, next_month} to month_range for "April 2006"
(* modify as required - should also accept a date, month string or month constant *)


tell application "iPhoto" to name of photo library album's photos whose date comes after ¬
prev_month and date comes before next_month and name of keywords contains "cats"
-----------


or ('music files beginning with 'Night' or 'The Night')

-----------
tell application "iTunes" to name of tracks of playlist 1 whose name starts with "Night" or name starts with "The Night"
-----------


or ('backup all files whose extension is 'xml' except this one')

-----------
tell application "Finder" to files of (choose folder) whose name extension is "xml" and name is not "excluded.xml"
-----------


---
kai


_______________________________________________ Do not post admin requests to the list. They will be ignored. Applescript-users mailing list (email@hidden) Help/Unsubscribe/Update your Subscription: This email sent to email@hidden
References: 
 >whose clause with two conditions? (From: Ruth Bygrave <email@hidden>)

  • Prev by Date: Re: Exiting a repeat loop if not false
  • Next by Date: Re: Searching for cells/rows/columns in Excel
  • Previous by thread: Re: whose clause with two conditions?
  • Next by thread: Suppress dialog box
  • Index(es):
    • Date
    • Thread