Re: More date/time stuff
Re: More date/time stuff
- Subject: Re: More date/time stuff
- From: Simon Topliss <email@hidden>
- Date: Thu, 19 Nov 2009 23:05:17 +0000
Is that really a valid rant? Don't most programming languages allow the 'setting' of a constant?
set AppleScript's pi to "apple" -- this is a perfectly valid AS command, but try calculating the area of a circle now
Simon
On 19 Nov 2009, at 22:23, Emmanuel LEVY wrote:
> I rarely second a rant against AppleScript, but we have to admit that "constants" that you can set to an arbitrary value is a feature which may hurt heavily.
>
> set days to 30 -- looks innocent, isn't it?
>
> Emmanuel
>
>
> On Nov 19, 2009, at 10:07 PM, Paul Berkowitz wrote:
>
>> Oops! I didn't spot that! Thanks, Emmanuel.
>>
>> This indeed (as I had a sneaking memory and regrettably did not check) is
>> one of those situations that absolutely needs 'its':
>>
>> set today to current date
>> tell today to set {its hours, its minutes, its seconds} to {0, 0, 0}
>> today
>> --> date "Thursday, November 19, 2009 12:00:00 AM"
>>
>> --
>> Paul Berkowitz
>>
>>
>>> From: Emmanuel Levy <email@hidden>
>>> Date: Thu, 19 Nov 2009 22:01:25 +0100
>>> To: AppleScript-Users <email@hidden>
>>> Subject: Re: More date/time stuff
>>>
>>> I wouldn't try this script.
>>>
>>> If I'm correct, the script below won't change "today". It will only
>>> change the AppleScript constant "hours" (which usually evaluates to
>>> 3600) into 0, and same for "minutes" (was 60, is now 0).
>>>
>>> Emmanuel
>>>
>>>
>>> On Nov 19, 2009, at 8:38 PM, Paul Berkowitz wrote:
>>>
>>>> We've been through this a hundred times. You can't set a list of
>>>> properties of some object to a list of anything (text items, number
>>>> items, application object items), although you can of course get a
>>>> list of properties. You can, however, tell it to do so:
>>>>
>>>> set today to current date
>>>> tell today
>>>> set {hours, minutes, seconds} to {0, 0, 0}
>>>> end tell
>>>> --> {0, 0, 0}
>>>>
>>>> The one-liner
>>>>
>>>> tell today to set {hours, minutes, seconds} to {0, 0, 0}
>>>>
>>>>
>>>> works just as well.
>>>
>>> Or just as bad.
>>>
>>> set today to current date
>>> tell today to set {hours, minutes, seconds} to {0, 0, 0}
>>> today
>>> -- date "Thursday, November 19, 2009 9:58:04 PM"
>>>
>>> _______________________________________________
>>> 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
>>
>>
>> _______________________________________________
>> 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
>
> _______________________________________________
> 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
_______________________________________________
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