True session auto backup...
Hello!
I work with Pro tools and have many times had trouble with auto session backup, a feature unique to Pro tools.
He said he backs up every 1 minute, but when trouble arises, I sometimes goes back to almost 10 minutes ago. (Why?)
To solve this problem, I would like to create a script that automatically does a command + s every minute as a simplified version for now.
Here are the current works
var pollingIntervalMs = 60000;
sf.engine.runInBackground(function () {
while (true) {
sf.engine.checkForCancellation();
if (sf.ui.proTools.mainWindow.invalidate().sessionPath !== null) {
sf.keyboard.press({
keys: "cmd+s",
});
}
sf.wait({
intervalMs: pollingIntervalMs,
executionMode: 'Background'
});
}
});
As it is, I would like to stop this script when I focus on an application other than Pro tools, because it tries to press ⌘ + S even when I am working in the Finder.
And I think it would work if I make the trigger of this loop script to activate Pro tools.
Please give me some advice!
Best
- Raphael Sepulveda @raphaelsepulveda2022-05-28 15:36:11.677Z
Hey @Yujiro_Yonetsu,
Add this at the beginning of the while loop to stop the script if Pro Tools is not the focused app.
if (sf.ui.frontmostApp.activeBundleID !== "com.avid.ProTools") return;
Christian Scheuer @chrscheuer2022-05-28 15:45:55.564Z
^^This
And, I would recommend using a menu click on File -> Save instead of simulating a keystroke. (This would actually also alleviate the need to bypass this when PT is not focused)
Yujiro Yonetsu @Yujiro_Yonetsu
Thank you @raphaelsepulveda @chrscheuer !
Worked fine. It's perfect, thank you.
By making it menu click,
I had avoided it because I thought it would be disturbing if the menu was momentarily expanded each time,
but I tried it and was able to do it without the menu being expanded.
This is better.Now that the idea has died out once and for all for development from here,
I'll just use it as is for the next few days.Best!