Subject: | |
From: | |
Reply To: | |
Date: | Thu, 24 Sep 2009 10:51:47 +0100 |
Content-Type: | text/plain |
Parts/Attachments: |
|
|
"Mark J. Reed" wrote on Wed, 23 Sep 2009 09:04:41 -0400:
>On Wed, Sep 23, 2009 at 9:01 AM, Nigel Garvey
><[log in to unmask]> wrote:
>> =C2=A0 =C2=A0set file_name to ((it div 100000000) as text) & (it mod 1000=
>00000 div
>> 1) & ".html"
>
>What does the "div 1" accomplish here?
'(current date) - zdate' ('it') is now so large that it's returned as a
real, hence the E-notation. 'it mod 100000000' is small enough to be an
integer, but since it's derived from a real, it's a real too and its text
representation will be either E-notation or something ending with ".0".
Divving it by 1 gives an integer result.
However, I screwed up by forgetting that if the mod result is less than
10000000, it will need some leading zeros before being concatenated to
the first bit of text, so:
property zdate : date "Monday 10 August 1992 11:00:00"
tell (current date) - zdate
set file_name to ((it div 100000000) as text) & text 2 thru 9 of
((100000000 + it mod 100000000 div 1) as text) & ".html"
end tell
NG
|
|
|