Time format
Time format
- Subject: Time format
- From: ba95 <email@hidden>
- Date: Sun, 18 Nov 2007 12:06:55 +0100
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'
-- Script
try
with timeout of 1000 seconds
tell application "Finder"
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 t to TotalTime
set h to t div 3600
set tr to (t mod 3600)
set x to (tr div 60)
set m to leadZero(x) -- 'of me' tried unsuccessfully
set x to (tr mod 60)
set s to leadZero(x) -- 'of me' tried unsuccessfully
set TotalTime to m & ":" & s as string
on leadZero(x)
if x is less than 10 then
return "0" & x
else
return x as string
end if
end leadZero
-- End of time formating
end if
end tell
end timeout
end try
-- End of script
When I compile, I get a syntax error message:
"else" expected, but "on" found
with "on" highlighted in "on leadZero(x)".
Could you help me, please.
Thanks in advance.
This list is great for AS beginners.
BA
_______________________________________________
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