Promp with option to continue or cancel macro
Hi!
I have a designed a script that does a lot of time based modification in the session.
The trigger is a key on one of my stream decks. In the heat of a mix, there are chances I click it by mistake, which would wreak havoc in my current session.
I'd like to add a prompt in the very beggining that works like that.
Press macro button on stream deck
Promp: are you sure you want to continue? Click OK to continue Abort to cancel.
If clicking abort, the strip doesn't go thru.
Any idea?
Best,
T
- samuel henriques @samuel_henriques
Hello @Thomas_Gloor:
I think this is what you are looking for
- TThomas Gloor @Thomas_Gloor
Hey @samuel_henriques ,
Thank you! I used
//Create variable for confirmation popup. var confirmAnswer; //Confirmation popup. if (confirm("Do you want to continue?") == false) { alert("The macro has been canceled"); sf.soundflow.stopAll(); }
But I do not understand where to put the
throw 0;
So I can avoid the SF notification at the top right of the window.
Any idea?
Best,
Tsamuel henriques @samuel_henriques
I think Christians's explanation works best:
if (!confirm("Do you want to continue?")) throw 0;
but if you still want to be informed it stoped:
if (!confirm("Do you want to continue?")) { log('Cancelled', 'Title of notification'); throw 0; }
samuel henriques @samuel_henriques
Kitch had the same question as you did. His code was almost there.
- TThomas Gloor @Thomas_Gloor
Thank you! I think I just to have a good grasp on what throw is...
Thanks again!
- In reply tosamuel_henriques⬆:TThomas Gloor @Thomas_Gloor
also, funny enough, when using
if (!confirm("Do you want to continue?")) throw 0;
and cancelling, it still proceeds with the script!
samuel henriques @samuel_henriques
try to restart soundFlow after changing the script. The stream deck or surfaces might still get the script when they booted.
- TThomas Gloor @Thomas_Gloor
Hey!
I tried, but it still goes on! Maybe a wait?
- TIn reply toThomas_Gloor⬆:Thomas Gloor @Thomas_Gloor
it does so in 2 different scripts
samuel henriques @samuel_henriques
Something else is going on.
You see the confirmation dialog?
try on a new blank script:
if (!confirm("Do you want to continue?")) throw 0; log("Hello")
If you click ok, it should log "Hello"
If you click cancel nothing should happen- TThomas Gloor @Thomas_Gloor
Your script does what it should,
but when inserted in my script, it just doesn't stop when clicking cancel...
weird...samuel henriques @samuel_henriques
Submit a help/issue, the guys will be able to look into other details to figure it out.
- TThomas Gloor @Thomas_Gloor
actually I tried.
It seems to be the Throw 0 that doesn't work. Is there anything I should do to make it work? Define something beforehand?
Dustin Harris @Dustin_Harris
Are you using an uppercase T on throw 0? It should be lowercase…
- TThomas Gloor @Thomas_Gloor
OH! Might be! I'll check when back at the studio!
Thank you!