MACSCRPT Archives

May 2006

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:
John Delacour <[log in to unmask]>
Reply To:
Macintosh Scripting Systems <[log in to unmask]>
Date:
Fri, 19 May 2006 17:34:56 +0100
Content-Type:
text/plain
Parts/Attachments:
text/plain (29 lines)
At 10:19 am -0400 19/5/06, Duane L. Mitchell wrote:

>Here's the script:
>
>property pReferenceDate : date "Wednesday, January 1, 2003 12:00:01 AM"
>set vDocNumber to ((current date) - pReferenceDate) as inches as string
>display dialog "The number is: " & vDocNumber
>
>The "as inches as string" is my latest attempt at coercing the number to a
>string.

In 10.4.6 'display dialog' will automatically coerce the sci notation 
to string provided to don't try your own coercion first.

But I'm guessing you don't want a dialog and the simplest trick I 
know of is to get Perl to do it, as below:


property pReferenceDate : "1/1/1803"
set vDocNumber to ((current date) - (get date pReferenceDate))
--=> 6.418113912E+9
display dialog "" default answer vDocNumber
-- or
do shell script "perl -e 'print " & vDocNumber & "'"
--=> 6418114152


JD

ATOM RSS1 RSS2