Created
March 19, 2020 18:40
-
-
Save fuji246/3929962664d855b987284787fec4ff94 to your computer and use it in GitHub Desktop.
capture skype UI media statistics
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/osascript | |
on todayISOformat() | |
set dateFormat to "%T" | |
set theDate to current date | |
set y to text -4 thru -1 of ("0000" & (year of theDate)) | |
set mon to text -2 thru -1 of ("00" & ((month of theDate) as integer)) | |
set d to text -2 thru -1 of ("00" & (day of theDate)) | |
set H to text -2 thru -1 of ("00" & (hours of theDate)) | |
set M to text -2 thru -1 of ("00" & (minutes of theDate)) | |
set S to text -2 thru -1 of ("00" & (seconds of theDate)) | |
return y & "-" & mon & "-" & d & " " & H & ":" & M & ":" & S | |
end todayISOformat | |
# helper function for command parameters | |
on stringSplit(str, delimiters) | |
# save delimiters to restore old settings | |
set oldDelimiters to AppleScript's text item delimiters | |
# set delimiters to delimiter to be used | |
set AppleScript's text item delimiters to delimiters | |
# create the array | |
set splitedArray to every text item of str | |
# restore the old setting | |
set AppleScript's text item delimiters to oldDelimiters | |
# return the result | |
return splitedArray | |
end stringSplit | |
on logToFile(logText, textFile, append) | |
log logText | |
if append is false then | |
set redirect_flg to " > " | |
else | |
set redirect_flg to " >> " | |
end if | |
do shell script "echo " & quoted form of logText & redirect_flg & quoted form of textFile | |
end logToFile | |
set filepath to "/tmp/skype.log" | |
logToFile("", filepath, false) | |
repeat while true | |
tell application "System Events" | |
tell process "Skype" | |
activate | |
set frontmost to true | |
set stats to value of text area 1 of scroll area 1 of window "Technical Call Info" | |
set logItems to my stringSplit(stats, "\n") | |
repeat with li in logItems | |
my logToFile(my todayISOformat() & " - " & li, filepath, true) | |
end repeat | |
end tell | |
end tell | |
delay 1 | |
end repeat |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment