vMix Forums
»
General
»
General Discussion
»
Disable shortcut while script is running
Rank: Member
Groups: Registered
Joined: 8/8/2019(UTC) Posts: 26 Location: Georgia Was thanked: 2 time(s) in 2 post(s)
|
I have several shortcuts that call scripts. "F1" calls Script1 for example. The script is moving cameras around and so there are a few Sleep statements that cause the script to run about 4 seconds.
All is well until you accidentally press "F1" again while the called script is already running. This causes an error and halts the program until you click on the "OK" to acknowledge your misstep.
In more robust VBnet environments you could access a flag to disable the shortcut while the script is running and enable it upon exiting.
Is there something of this sort hidden away in vMix or can anyone think of a workaround?
Many thanks..
|
|
|
|
Rank: Advanced Member
Groups: Registered
Joined: 2/23/2017(UTC) Posts: 189 Thanks: 1 times Was thanked: 52 time(s) in 42 post(s)
|
Make a title input. On the F1 press, check if the title input contains 1 or 0. If it is 0, then continue with the processes and set the title input to 1. Last thing this script would do, is set the title input back to 0. If the title input value is 1, do nothing.
|
|
|
|
Rank: Member
Groups: Registered
Joined: 8/8/2019(UTC) Posts: 26 Location: Georgia Was thanked: 2 time(s) in 2 post(s)
|
I think this approach will work but it seems you would need a separate script to test running or not. For example:
Press "F1" to start ScriptTest_F1. ScriptTest_F1 would check the variable and if "0" then call Script1, If "1" it would simply end. This way Script1 would never be "called" if it was already running.
However, how do you call or transfer to another script from within a script. I tried: API.Function("ScriptStart","Script1") and got the "can't find that script error"
|
|
|
|
Rank: Advanced Member
Groups: Registered
Joined: 12/27/2012(UTC) Posts: 5,289 Location: Belgium Thanks: 296 times Was thanked: 967 time(s) in 801 post(s)
|
Originally Posted by: john30120 However, how do you call or transfer to another script from within a script. I tried: API.Function("ScriptStart","Script1") and got the "can't find that script error"
Try API.Function("ScriptStart",Value:="Script1") tip: check shortcuts to see items needed in a function
|
|
|
|
Rank: Member
Groups: Registered
Joined: 8/8/2019(UTC) Posts: 26 Location: Georgia Was thanked: 2 time(s) in 2 post(s)
|
Thanks all,
doggy is correct. API.Function("ScriptStart",Value:="Script1") does work.
Oddly I stumbled upon API.Function("ScriptStart",,"Script1") and this works as well.
Apparently, an optional variable is part of this form of the command.
Also, I found that using the title XAML as a global variable holder is quite handy. With the Title designer (either Legacy or GT) you can create a title XAML with any number of Textboxes and use them all in your scripts with just that one Input.
|
1 user thanked john30120 for this useful post.
|
|
|
Rank: Advanced Member
Groups: Registered
Joined: 12/27/2012(UTC) Posts: 5,289 Location: Belgium Thanks: 296 times Was thanked: 967 time(s) in 801 post(s)
|
Originally Posted by: john30120
Also, I found that using the title XAML as a global variable holder is quite handy. With the Title designer (either Legacy or GT) you can create a title XAML with any number of Textboxes and use them all in your scripts with just that one Input.
This is funny..but glad you found it.. after MartLeib sugested it a few replies up and has been common practise in xaml titles to say hold color values from datasources for other inputs amongst other examples in this forum.
|
|
|
|
vMix Forums
»
General
»
General Discussion
»
Disable shortcut while script is running
Forum Jump
You cannot post new topics in this forum.
You cannot reply to topics in this forum.
You cannot delete your posts in this forum.
You cannot edit your posts in this forum.
You cannot create polls in this forum.
You cannot vote in polls in this forum.
Important Information:
The vMix Forums uses cookies. By continuing to browse this site, you are agreeing to our use of cookies.
More Details
Close