MACSCRPT Archives

September 2009

MACSCRPT@LISTSERV.DARTMOUTH.EDU

Options: Use Monospaced Font
Show Text Part by Default
Show All Mail Headers

Message: [<< First] [< Prev] [Next >] [Last >>]
Topic: [<< First] [< Prev] [Next >] [Last >>]
Author: [<< First] [< Prev] [Next >] [Last >>]

Print Reply
Subject:
From:
Brian Johnson <[log in to unmask]>
Reply To:
Macintosh Scripting Systems <[log in to unmask]>
Date:
Tue, 22 Sep 2009 11:52:40 -0700
Content-Type:
TEXT/PLAIN
Parts/Attachments:
TEXT/PLAIN (27 lines)
Hi all,

I have a script that builds a file name as an offset from a past 
zero-point in time

   property zdate: date "Monday, August 10, 1992 11:00:00 AM"
   set file_name to ((current date)-zdate as text) & ".html"

Until quite recently, it produced strings like "540175411.html" quite 
reliably. Now it makes "5.40175411E+8.html" ... not quite the desired 
effect. I seem to have passed a threshold in the "number-to-text" coercion 
that flips into exponentiation (but it *could* be exponent-free).

The resulting string actually works in the script, but the file 
names just don't look right, and may mess up some other scripts. 
So... anybody know how a way to force this back into an integer-like 
string (without modulo aritmetic and slicing off digits one at a time) ?
I tried "as integer", and "as number as text" but without luck.

I could move the zero-point forward, but it has sentimental value, and 
there are *many* existing files with names based on this -- I hate to 
consider some of the sorting and collision consequences...

Thanks for your insights and suggestions (fingers crossed).

   -b.johnson, dept of architecture, university of washington, seattle

ATOM RSS1 RSS2