Track Active Time in Pro Tools (Time Tracker)
@Jascha_Viehl & @danielkassulke, I'm creating a new thread for the idea @Jascha_Viehl had to track "idle time" in Pro Tools since it seemed to stray from @Andrew_Sherman's original post.
As food for thought on this, macOS can track "idle time" based on the last input received from a keyboard or mouse.
The main code for this is:
sf.system.exec({
commandLine:
`ioreg -c IOHIDSystem | awk '/HIDIdleTime/ {print $NF/1000000000; exit}'`
}).result
↑ This gives you the time in seconds that keyboard and mouse activity has been inactive.
As an interesting experiment, here's a "run forever" script (example here) that will log "inactive" time once a minute after 5 minutes of inactivity.
function main() {
let idleTime = Number(sf.system.exec({
commandLine:
`ioreg -c IOHIDSystem | awk '/HIDIdleTime/ {print $NF/1000000000; exit}'`
}).result)
if(idleTime > 300){
log(`the computer has been idle for ${idleTime/60} minutes`)
}
}
// Runforever script
// Example here : https://forum.soundflow.org/-989#post-7
function runForever(name, action, interval, timeout) {
var now = (new Date).valueOf();
if (now - globalState[name] < timeout) throw 0; //Exit if we were invoked again inside the timeout
globalState[name] = now;
sf.engine.runInBackground(function () {
try {
while (true) {
sf.engine.checkForCancellation();
globalState[name] = (new Date).valueOf();
action();
sf.wait({ intervalMs: interval, executionMode: 'Background' });
}
} finally {
globalState[name] = null;
}
});
}
runForever("idleTimeTracker", main, 60000, 5000);
I do believe that runForever scripts may terminate if the computer sleeps, but you can always mess with adding a "caffeinate" command to this to avoid sleep.
// Caffeinate (Suspend Sleep Settings)
setTimeout(() => { sf.system.exec({ commandLine: `caffeinate -di &`, }) }, 100)
sf.wait({ intervalMs: 110 });
- Chad Wahlbrink @Chad2023-09-20 14:15:48.137Z
Also, to avoid reinventing the wheel, many apps are already capable of tracking time spent working in Pro Tools.
I use Timing App for tracking all of my work in audio software. It neatly organizes time spent in each pro tools session (by session name) or app (iZotope RX when I use RX connect, etc.). It then tracks idle time when you walk away from the computer.
I've also heard about HOFA's ProjectTime application made more specifically for audio. There's also a freeware version of that, I believe.
I am not discouraging anyone from using SoundFlow to serve similar functions. However, there is a benefit to utilizing SoundFlow alongside other apps that already solve problems sufficiently. 🤘Chad Wahlbrink @Chad2023-09-20 14:41:40.208Z
Also, some discussion about interfacing Timing App with SoundFlow if helpful:
- JIn reply toChad⬆:Jascha Viehl @Jascha_Viehl
Thank you very much, Chad!
I'll check the script out! - DIn reply toChad⬆:danielkassulke @danielkassulke
Thanks, Chad! This is really good to know.