Re: Days and hours
Re: Days and hours
- Subject: Re: Days and hours
- From: Christopher Nebel <email@hidden>
- Date: Wed, 19 Oct 2005 14:46:48 -0700
On Oct 19, 2005, at 2:23 PM, Mark J. Reed wrote:
On 10/19/05, Christopher Nebel <email@hidden> wrote:
Passing a constant to "choose from list" or any other scripting
addition that expects text, such as "display dialog", will result in
the four-character code for that constant.
Oh. I would have expected "as string" or "as text" to be tried
first. OK, that explains a lot.
The problem is that "as string" means different things to AppleScript
itself versus a scripting addition. Like I said (but you didn't
quote), explicitly coercing a constant to "string" will result in a
string that is the constant name. For example, 'January as string'
results in '"January"'. However, only the AppleScript core has the
information necessary to do that. If you try to do the coercion
implicitly by just passing the constant, it happens inside the
scripting addition, where the core is not accessible, so you get the
simple-minded conversion using the raw code.
I have one other question in this general topic area: given that
(date "some date string") honors your current system preferences,
what's the easiest way to initialize a date object in a way that
*doesn't* honor them? Say I want to pass around uncompiled code as
text and have it work wherever my correspondents happen to be
regardless of their prefs. Is this the only way?
set myDate to current date
set year of myDate to 1968
set month of myDate to May
set day of myDate to 5
set time of myDate to (20 * 60 + 47) * 60
As far as I'm aware, yes, though I'm sure someone else here will
suggest something fiendish. I've been kicking around the idea of
allowing ISO 8601 date specifications, but it has yet to gain
significant traction.
--Chris Nebel
AppleScript and Automator Engineering
_______________________________________________
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