Re: How to get every message that meets a condition in Mail
Re: How to get every message that meets a condition in Mail
- Subject: Re: How to get every message that meets a condition in Mail
- From: kai <email@hidden>
- Date: Tue, 04 Nov 2003 00:05:54 +0000
on Mon, 3 Nov 2003 00:45:04 -0800, Christian Boyce wrote:
>
I am so close to figuring this out but keep failing. Can you help?
>
>
Using Mail in 10.3, I want to get every message that was sent today
>
(and then do stuff with it).
>
>
I figured it would be something like this:
>
>
set today to date string of (current date)
>
--
>
tell application "Mail"
>
set themessages to every message whose date sent is today
>
end tell
>
Problem: "date sent" includes the time. I only want to compare dates.
>
And, Mail doesn't seem to offer a way to pick off just the date (no
>
"date string" command).
>
>
I'm sure that it's easy when you know how...
You'd probably be better off directly comparing date values, Christian. This
works for me:
--=========================
set today to current date
set today's time to 0
tell application "Mail"
set theMessages to messages of mailbox "Sent Messages" of account
"kai" whose date sent >= today
end tell
--=========================
If you want messages sent on a date other than today, then you might use
something like:
--=========================
set tgtDate to "10/10"
set d to date tgtDate
tell application "Mail"
set theMessages to messages... whose date sent > d - 1 and date sent
< d + days
end tell
--=========================
---
kai
_______________________________________________
applescript-users mailing list | email@hidden
Help/Unsubscribe/Archives:
http://www.lists.apple.com/mailman/listinfo/applescript-users
Do not post admin requests to the list. They will be ignored.