Preview mode warning (Pro Tools)
Hello, it would be great if you would get a warning that stays on the screen when you're in preview mode an disapears when you're out. Would be great if it would be a floating window that is draggable and resizeable, so you could put it on a prefered position on your screen.
It would save me a lot of useless passes because I was still in preview...
Linked from:
- LLucas Frisch @Lucas_Frisch
Hey !
I m really not a java script guy but i really like the idea and i m trying to figure something out by searching bits of code...
I have some trouble and maybe some more advance coding people could help me out.My idea is to display a big surface green or red if preview is on or off ( i tried on the mac but it makes pro tools display buggy so i going my telephone route for now.)
my first problem is this :
this works :
sf.ui.proTools.appActivateMainWindow(); //Button var previewAutomationBtn = sf.ui.proTools.automationWindow.buttons.whoseTitle.is('Enable Auto Preview Mode').first; //Check if button is enabled if (previewAutomationBtn.invalidate().value.value == "Selected") { sf.surfaces.get('user:cl1tm5xan000cng10ohmfnl97:cl1tm65u1000dng10tv58qn5w').open({ device: sf.devices.mobile.getByDeviceId('mobile.25bbc8803fdd3389--Galaxy-S9-de-Lucas'), }); } else { log("Automation Preview is not enabled"); };
but this doesn't :
sf.ui.proTools.appActivateMainWindow(); //Button var previewAutomationBtn = sf.ui.proTools.automationWindow.buttons.whoseTitle.is('Enable Auto Preview Mode').first; //Check if button is enabled if (previewAutomationBtn.invalidate().value.value == "Selected") { sf.surfaces.get('user:cl1tm5xan000cng10ohmfnl97:cl1tm65u1000dng10tv58qn5w').open({ device: sf.devices.mobile.getByDeviceId('mobile.25bbc8803fdd3389--Galaxy-S9-de-Lucas'), }); } else { sf.surfaces.get('user:cl1tm5xan000cng10ohmfnl97:cl1tmex7x000lng109pifex9x').open({ device: sf.devices.mobile.getByDeviceId('mobile.25bbc8803fdd3389--Galaxy-S9-de-Lucas'), });
I suppect it's coding basics but that where i am at..
for now my the script is set to an application trigger but is there a way to SF to monitor the preview state constantly? without making everything buggy or slow obviously?
- In reply toErik_Griekspoor⬆:Erik Griekspoor @Erik_Griekspoor
Wow great! I can’t do coding unfortunately.. Would be even better if it turns orange when in preview suspend, but I dont want to push 😉
- MIn reply toErik_Griekspoor⬆:Martin Pavey @Martin_Pavey
This is something I'd really be interested in too.
Is there a way to get Soundflow to flash a button on a streamdeck or surface?
I have 2 commands/Streamdeck buttons I use for entering preview and then writing to selection.
One could switch on the flashing and the write command could switch it off?
Maybe a notification would work or just opening a graphic and then closing it.
'It would save me a lot of useless passes because I was still in preview...'
I feel your pain Erik. ;-) - LIn reply toErik_Griekspoor⬆:Lucas Frisch @Lucas_Frisch
Thanks for your interest Martin,
I think i m pretty close to have something working with the script above , but we need some javascript guru to helps us..,i ll try to post on the script help forum and maybe we ll have more luck..
- CIn reply toErik_Griekspoor⬆:Chris Stangroom @Chris_Stangroom
After having been diving into this for more time today than I really wanted to, the hardest thing to figure out so far in Javascript is how to find the status of sf.ui.proTools.automationPreview. I have tried invalidate, but that does not seem to be a recognized action.
Chad Wahlbrink @Chad2024-10-22 18:04:03.720Z
Hi, @Chris_Stangroom (and others!),
Monitoring on/off states is tricky, so SoundFlow generally does not support dynamic button states for standard SoundFlow scripts and Macros. You can read more about this here:
However, to get dynamic states of the Automation Window and, specifically, Preview Mode in SoundFlow, you can get the Pro Tools Automation Package. This package is a premium app, so it's a one-time $19 cost to add the functionality to SoundFlow.
Here's a video of that app in action:
- In reply toChris_Stangroom⬆:
Chad Wahlbrink @Chad2024-10-22 18:07:14.711Z
Also, note if you are just trying to react to whether Preview is enabled, you can use something like this:
if(sf.ui.proTools.automationWindow.buttons.whoseTitle.is("Enable Auto Preview Mode").first.value.value === 'Selected'){ log('Preview is Enabled') } else if (sf.ui.proTools.automationWindow.buttons.whoseTitle.is("Enable Auto Preview Mode").first.value.value === ''){ log('Preview is Disabled') }
When enabled,
sf.ui.proTools.automationWindow.buttons.whoseTitle.is("Enable Auto Preview Mode").first.value.value
will returnSelected
.
- CIn reply toErik_Griekspoor⬆:Chris Stangroom @Chris_Stangroom
Thanks for this, Chad. I like to build Surfaces for my workflow so I'm curious if items from the Automation Package can be added to one of my Surfaces and still reflect the automation state. Thanks!
Chad Wahlbrink @Chad2024-10-23 17:08:49.994Z
No problem, @Chris_Stangroom.
The commands in the Pro Tools Automation Package are meta commands, which means they can be added to any deck and displayed on iOS and Android devices.
I don't believe it's possible to add a meta command to a surface at the moment, but that's a great idea. If you'd like to see that functionality added to SoundFlow, you can log it in the Ideas section of the forum for future consideration.
- OIn reply toErik_Griekspoor⬆:Owen Granich-Young @Owen_Granich_Young
You need to get this app https://apps.apple.com/us/app/overlays/id868499627?mt=12 - the fucntion basically quits and opens this app depending on Preview status. Run script to start the run forever, run script again to stop the run forever.
let lastPreviewStatus; globalState.runAutoFollowOutputWin = !globalState.runAutoFollowOutputWin; function main() { // Get current state of Automation Window const isClipListEnabled = sf.ui.proTools.getMenuItem("Window", "Automation").isMenuChecked // Open Automation Window if It's not if (!isClipListEnabled) { sf.ui.proTools.menuClick({ menuPath: ["Window", "Automation"], }); } try { const automationWindow = sf.ui.proTools.automationWindow.invalidate(); if (automationWindow) { // Check the status of the "Enable Auto Preview Mode" button let previewStatus = sf.ui.proTools.automationWindow.buttons .whoseTitle.is("Enable Auto Preview Mode") .first.value.value; if (previewStatus === lastPreviewStatus || previewStatus === undefined) return; lastPreviewStatus = previewStatus; // Log based on the status of the preview button if (previewStatus === 'Selected') { /* log("Preview is on!") */ sf.app.launch({ path: '/Applications/Overlays!.app' }); } else if (previewStatus === '') { /* log("Preview is off!") */ sf.ui.app('es.abbiecod.overlays').appQuit({ onError: "Continue" }); } } } catch (err) { /* log('Error: ' + err.message); */ } } function runForever(name, action, interval, timeout) { sf.ui.proTools.appActivate(); sf.ui.proTools.invalidate(); log('Preview Warning Activated') let 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 && globalState.runAutoFollowOutputWin) { sf.engine.checkForCancellation(); globalState[name] = (new Date).valueOf(); action(); sf.wait({ intervalMs: interval, executionMode: 'Background' }); } } finally { globalState[name] = null; log('Preview Warning Deactivated') } }); } // Start the runForever process runForever("isFollowPreviewStatusRunning", main, 500, 5000);
- GGregor Bonse @Gregor_Bonse
What's the app called @Owen_Granich_Young?
It seems to be offline in appstore.Does anyone have a working solution for being warned of the Preview state?
- OOwen Granich-Young @Owen_Granich_Young
Oh yeah doesn't seem available anymore.
But I can't find it online either. Sorry.
- LLars van Leeuwen @Lars_van_Leeuwen
It seems to be back on the app store. Works kind-a for me. For some reason the code is interfering with the mouse. For instance whenever I open a menu it closes immediately. not sure why it does this but when I disable the script this weird behavior is gone as well.
Chad Wahlbrink @Chad2025-06-19 13:48:25.936Z
@Lars_van_Leeuwen, this sounds like an issue that happens on macOS Sonoma and above. MacOS made changes in this release that cause problems with "runForever" scripts like the one @Owen_Granich_Young shared.
This is fixed for Pro Tools 2024.10 and above. What version of Pro Tools are you running?
- LLars van Leeuwen @Lars_van_Leeuwen
Hi @Chad,
Wow, didn't expect to get support on such an old thread :) Thanks for getting back!Currently running Mac OS Sequoia 15.5 and Pro Tools 2024.10.
- OOwen Granich-Young @Owen_Granich_Young
Lars I seem to recall that happening, we kinda never fixed that bug, everyone lost interest in it 😅. @Kitch wrote the ‘keep the automation window visible’ piece of code he may have some good idea how to handle the persisting in denying menu and load window navigation.
Sorry I can’t look at it myself right now.
Bests
OwenKitch Membery @Kitch2025-06-20 21:23:48.408Z
I think I recall that one. I'll take a look in my account early next week to see if I still have it.
- BBrandon Jiaconia @Brandon_Jiaconia
I had similar problems with the Overlays app and runforever scripts. I found a separate app called Anybar that makes an icon in the top menu bar which you can set the color of. https://github.com/tonsky/AnyBar
Then attaching the color of that icon to the state of the preview button with a toggle:function main() { // Open Automation window const isAutomationWindowOpen = sf.ui.proTools.getMenuItem("Window", "Automation").isMenuChecked; if (!isAutomationWindowOpen) { sf.ui.proTools.menuClick({ menuPath: ["Window", "Automation"] }); } // Refresh UI state const automationWindow = sf.ui.proTools.automationWindow.invalidate(); if (!automationWindow.exists) return; const previewButton = automationWindow.buttons.whoseTitle.is("Enable Auto Preview Mode").first; const currentStatus = previewButton.value.value; // Click the button to toggle previewButton.elementClick(); // Wait for Pro Tools to update the button status sf.wait({ intervalMs: 50 }); // Refresh and check new status const newStatus = sf.ui.proTools.automationWindow.invalidate().buttons.whoseTitle.is("Enable Auto Preview Mode").first.value.value; // Determine color and send to Anybar const color = newStatus === 'Selected' ? 'green' : 'red'; sf.system.exec({ commandLine: `bash -c 'echo -n "${color}" > /dev/udp/localhost/1740'` }); // Close the Automation window sf.ui.proTools.menuClick({ menuPath: ["Window", "Automation"] }); } // Run main();
I have a few versions of this in my top menu bar so I can know if my talkback is open etc.