Last active
November 4, 2024 23:05
-
-
Save victorypoint/a4558199cdd27713e4d46b91650dc413 to your computer and use it in GitHub Desktop.
Retrieve iFit2 Workout Metrics (treadmill speed and incline) via ADB
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
' iFit2-Metrics - 'Retrieve iFit2 Workout Metrics ( treadmill speed and incline) via ADB | |
' Author: Al Udell | |
' Revised: November 4, 2024 | |
'to debug - enable wscript.echo and run by cscript in command line | |
'on error resume next | |
'initialize | |
set wso = createobject("wscript.shell") | |
'ifit2 wolflog filename (static name, no date included) | |
infilename2 = "/sdcard/android/data/com.ifit.glassos_service/files/.valinorlogs/log.latest.txt" | |
wscript.echo infilename2 | |
'loop - process wolflog | |
Do | |
'query current speed | |
cmdstring = "adb shell tail -n5000 " & infilename2 & " | grep -a ""Changed KPH""" & " | tail -n1 | grep -oP ""(?<=to\s)\d+(\.\d+)?(?=\skph)""" | |
'wscript.echo cmdstring | |
'use synchronous exec | |
set oexec = wso.exec("cmd /c " & cmdstring) ' Execute adb command | |
'wait for completion | |
Do While oexec.Status = 0 | |
wscript.sleep 100 | |
Loop | |
sValue = oexec.stdout.readline | |
If sValue <> "" then | |
sValue = formatnumber(csng(sValue),1) | |
Else | |
sValue = 0 | |
End If | |
cSpeed = sValue | |
wscript.echo "Current speed: " & cSpeed | |
'query current incline | |
cmdstring = "adb shell tail -n5000 " & infilename2 & " | grep -a ""Changed INCLINE""" & " | tail -n1 | grep -oP ""(?<=to\s)[+-]?\d+(\.\d+)?(?=\s%)""" | |
'wscript.echo cmdstring | |
'use synchronous exec | |
set oexec = wso.exec("cmd /c " & cmdstring) ' Execute adb command | |
'wait for completion | |
Do While oexec.Status = 0 | |
wscript.sleep 100 | |
Loop | |
sValue = oexec.stdout.readline | |
If sValue <> "" then | |
sValue = formatnumber(csng(sValue),1) | |
Else | |
sValue = 0 | |
End If | |
cIncline = sValue | |
wscript.echo "Current incline: " & cIncline | |
wscript.echo | |
Loop |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment