Re: Dates
Re: Dates
- Subject: Re: Dates
- From: "Mark J. Reed" <email@hidden>
- Date: Thu, 3 Jan 2008 09:01:47 -0500
On Jan 3, 2008 2:35 AM, Michael <
email@hidden> wrote:
Aha...so it's similar to RealBasic, I think?
Date is an object. In order to get my date that I wish to compare, I
need to "convert" it to an object too, so Applescript will be able to
do this comparison.
Yes. In many object-oriented languages, the creation of a date object would look like something this:
new Date("Wednesday, January 2, 2008 3:22:23 PM")
Applescript is similar, and its "date" is in fact a class namet. But it differs in more than just syntax from most OO languages - objects don't have methods (commands are separately defined) and you can't define classes within AppleScript code, but only use classes defined by the scriptable applications and Scripting Additions on your system.
So, my task is to construct the string in a way that is "acceptable"
to Applescript?
Well, your task is to compare objects of the same type to each other. One way to construct a date is to use a string, but there are other ways. As to the format of the string, it depends entirely on how you have things set up in the International System Preferences panel.
ps...one more thing. I find that, on my machine here at work, asking
Applescript to define the "sub-list" from the list can take quite a
while...about 30 seconds at times. I get the "whirling ball of death"
but it finally resolves with the correct answer. Do you think that I
am asking too much, or is there something that can be done to optimize
this.
List operations are notoriously slow in AS. One thing to try is making the list variable a property instead, by e.g. adding this line to the top of your script:
property msgs: {}
Others more knowledgeable in tweaking performance will be more helpful...
And, Mark, thank you so much for that very helpful answer. If I
understand you, it will help a lot.
You're welcome, and thank you.
--
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>) |