G’day scripters.
In answering my own question from several days ago, I found a shell script that returns the time in seconds, to 12 decimal places.
Here’s the shell script.
Here’s some code snippets.
try
set my overAllTimeElapsed to (my readFile2("Safari Looper Time Keeper")) as number
set a to do shell script (my mgRightNow)
set theSiteTimeElapsed to a - (my intermediateDuration)
set AllTheTime to ((my overAllTimeElapsed) + theSiteTimeElapsed) as number
my writefile3("Safari Looper Time Keeper", AllTheTime)
end try
set overAllTimeElapsed to (round ((AllTheTime) * 1000)) / 1000
tell application “TextEdit”
activate
tell document 1
try
set its text to its text & return & return & "Overall Time Elapsed for every Cycle: " & my showTime(overAllTimeElapsed) & return
on showTime(passedSeconds)
try
set theDays to passedSeconds div (24 * 3600)
set theHours to passedSeconds div 3600 - (theDays * 24)
set theMinutes to (passedSeconds - (passedSeconds div 3600) * 3600) div 60
set theSeconds to passedSeconds - ((passedSeconds div 60) * 60)
set theSeconds to (round (theSeconds * 1000)) / 1000
set showDay to " days "
if theDays = 1 then set showDay to " day "
set showHour to " hours "
if theHours = 1 then set showHour to " hour "
set showMinute to " minutes "
if theMinutes = 1 then set showMinute to " minute "
set showSecond to " seconds"
if theSeconds = 1 then set showSecond to " second"
return theDays & showDay & theHours & showHour & theMinutes & showMinute & theSeconds & showSecond as text
on error errmsg
tell application "System Events"
activate -- brings System Events authentication dialog to front
display dialog "showTime " & errmsg giving up after 10
end tell
end try
return "Error"
end showTime
on readFile2(theDesktoprtfdFileName)
set p to 999
try
tell application "System Events"
set p to 6000
try
set p to 6001
set theDesktoprtfdFileNameTemp to ((path to desktop) & theDesktoprtfdFileName as text)
set p to 6002
set wholeList to read file (theDesktoprtfdFileNameTemp)
set p to 6003
return wholeList
on error errmsg
return ""
end try
end tell
on error errmsg
tell application "System Events"
activate
display dialog "Error in ReadFile2 " & errmsg & " p = " & p giving up after 10
end tell
end try
end readFile2
on writefile3(theFileName, (TheWriteItem as text))
try
tell application "System Events"
delay 0.02
try
set theFileName to ((path to desktop) & theFileName) as text
set fRef to (open for access file theFileName with write permission)
set eof fRef to 0
write TheWriteItem to fRef starting at eof
on error
try
close access fRef
end try
end try
try
close access fRef
end try
end tell
end try
end writefile3
Which returns this….
Overall Time Elapsed for every Cycle: 1 day 12 hours 59 minutes 5.282 seconds
And what, you ask, was the beginning of it all?
And it is this......
Existence that multiplied itself
For sheer delight of being
And plunged with numberless trillions of forms
So that it might
find
itself
innumerably
Sri Aurobindo