AppleScript : Track change (time tracking)
0
votes
0
answers
172
views
I have an app which display the number of minutes passed within a specific status
for e.g I'm online now since 102 min , the result of my script return
{"Online for 102:40"}
How can I get the value of the totals minutes spend in the same status ?
e.g if I go online 10min then offline 5min, then online again 50 min
I would need to save value to get some report like :
> " Total Online time : 60min, Offline 5min "
I wrote this for now but this only get the current value in the specific status as text.
repeat
delay 1
tell application "System Events"
tell process "app name"
try
set mYTAuxChecker to get value of static text of group 2 of toolbar 1 of window "app name" as text
on error
--
end try
end tell
end tell
end repeat
to get the int I did this
set s to quoted form of mYTAuxChecker
do shell script "sed s/[a-zA-Z\\']//g <<< " & s
set dx to the result
set numlist to {}
repeat with i from 1 to count of words in dx
set this_item to word i of dx
try
set this_item to this_item as number
set the end of numlist to this_item
end try
end repeat
and to get the world I made this
set mYTAuxCheckerAsText to first word of mYTAuxChecker
but then how can I summarise each statues and sum the total
Asked by Kevin
(2468 rep)
Sep 22, 2018, 08:54 AM
Last activity: Sep 23, 2018, 07:23 AM
Last activity: Sep 23, 2018, 07:23 AM