• 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
Fwd: Dates
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Fwd: Dates


  • Subject: Fwd: Dates
  • From: "Mark J. Reed" <email@hidden>
  • Date: Thu, 3 Jan 2008 08:53:13 -0500

Whups, saw Axel's reply and realized I hadn't sent mine to the list, just to Michael directly...

---------- Forwarded message ----------
From: Mark J. Reed <email@hidden>
Date: Jan 3, 2008 2:26 AM
Subject: Re: Dates
To: Michael <email@hidden>


This condition will never be true:

date sent is "anything"

because the date sent property is a date, not a string.  You need to compare it to a date.  You construct a date from a string by passing the string to the "date" constructor:

date sent is date "Wednesday, January 2, 2008 3:22:23 PM"

it looks redundant, but it's not.  The first "date" is part of the name of the "date sent" property; the second "date" converts a textual representation of a date/time into an actual date/time value, which in Applescript is a distinct type.  As humans, we automatically convert things between their mental concepts and textual descriptions, fluidly in both directions, all the time.   Computers can't do that as easily, and most programming languages reflect that difficulty.

Imagine taking an apple from a street vendor, taking a bite and then putting it back in the middle of a pile.   The vendor, horrified, starts sifting through the potatoes trying to find the one you took a bite of.  But no matter how many potatoes he looks at, none of them will be the apple in question.  That's the sort of comparison you're doing in your code...

On Jan 3, 2008 1:56 AM, Michael <email@hidden> wrote:
> Michelle,
>
> Can you figure why this is not working?
>
> tell application "Mail"
>
>         set msgs to every message of (mailbox "INBOX" of account "comcast")
> whose (message id is "email@hidden") and (date sent is "Wednesday,
> January 2, 2008 3:22:23 PM")
>
>
>         --set sentDate to date sent of firstMsg (gives : "Wednesday, January
> 2, 2008 3:22:23 PM")
>
> end tell
>
> gives {}
>
> In my Applescript book..."Ref guide" I do see that the construct "and"
> is supported, or, is this again Application specific? Or is there
> something else going on.?
>
> Your help...and guidance..is much appreciated.
> Michael.
>
>
>
>
>
>
>
> >
> > Messages do not have a "date" property.  The do have a "date sent"
> > and a "date received" property.
> >
> > tell application "Mail"
> >       tell item 1 of (get the selection)
> >               display dialog "Date received:  " & (date received as text)
> >               display dialog "Date sent:  " & (date sent as text)
> >       end tell
> > end tell
> >
> > --
> > "Democrats wrap themselves in the constitution and burn the flag
> > while Republicans wrap themselves in the flag and burn the
> > constitution."
> >
> >
> > _______________________________________________
> > Do not post admin requests to the list. They will be ignored.
> > AppleScript-Users mailing list      (applescript-
> > email@hidden)
> > Help/Unsubscribe/Update your Subscription:
> >
> >
> > This email sent to email@hidden
>
>
>  _______________________________________________
> Do not post admin requests to the list. They will be ignored.
>
> This email sent to email@hidden
>



--
Mark J. Reed < email@hidden>




--
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: 
 >Dates (From: Michael <email@hidden>)
 >Re: Dates (From: Michelle Steiner <email@hidden>)
 >Re: Dates (From: Michael <email@hidden>)

  • Prev by Date: Re: How can I round in applescript to 3 digits after a period?
  • Next by Date: Re: Dates
  • Previous by thread: Re: Dates
  • Next by thread: Re: Dates
  • Index(es):
    • Date
    • Thread