Re: Time format
Re: Time format
- Subject: Re: Time format
- From: "J. Stewart" <email@hidden>
- Date: Mon, 19 Nov 2007 13:37:56 -0500
On 11/18/07 at 6:06 AM, ba95 <email@hidden> spake thusly:
Hello scripters !
I am not an AS expert, as you will notice further.
Just an elementary issue.
I have written a backup script which works perfectly.
It produces a process ending message and a logs information
about what has been done and the time it took achieve its magic.
The time format goes like this: "xxx seconds".
I would like to format it like that:
'Time elapsed mm: ss' or
'Time elapsed mm minutes and ss seconds'
<snip>
Could you help me, please.
Thanks in advance.
This list is great for AS beginners.
I see you have it solved but here's my 2ยข anyway :)
As the others have said you had some stuff in the wrong place,
notably the leadZero handler. It should not be within any other
code block and its a good idea to precede calls to it with the
"my" keyword.
The thing I've noticed: Why is there a Finder tell block in it
at all? There's no need for it with the code you've posted. If
there is other code that requires it fine but it's best in the
long run to only put stuff you absolutely must within such a
block. As it is your code is filtering all the scripting
addition calls through the Finder slowing down your script.
There is an alternative to all the date manipulation in your
script. You might find the following "do shell script" does what
you want and replaces most of the code -
set TotalTime to do shell script "date -jr " & TotalTime & "'+%M:%S'"
leaving you with this equivalent version of your script -
--> Cut <--
try
with timeout of 1000 seconds
set debutemps to (current date)
set time1 to (time of (current date))
--Blah, blah...
set TotalTime to (time of (current date)) - time1
-- Time formating
set TotalTime to do shell script "date -jr " & TotalTime & " '+%M:%S'"
end timeout
end try
--> Cut <--
see:
<x-man-page//:date> for the unix date command
<x-man-page//:strftime> for how to format the date command output
--
Any government big enough to do things for you is big enough to
do things to you.
_______________________________________________
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