logo

Live Production Software Forums


Welcome Guest! To enable all features please Login or Register.

Notification

Icon
Error

Options
Go to last post Go to first unread
john30120  
#1 Posted : Sunday, January 5, 2020 9:17:48 AM(UTC)
john30120

Rank: Member

Groups: Registered
Joined: 8/8/2019(UTC)
Posts: 24
United States
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..
MartLeib  
#2 Posted : Sunday, January 5, 2020 9:22:19 AM(UTC)
MartLeib

Rank: Advanced Member

Groups: Registered
Joined: 2/23/2017(UTC)
Posts: 189
Estonia

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.
john30120  
#3 Posted : Sunday, January 5, 2020 10:43:20 AM(UTC)
john30120

Rank: Member

Groups: Registered
Joined: 8/8/2019(UTC)
Posts: 24
United States
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"
doggy  
#4 Posted : Sunday, January 5, 2020 12:24:04 PM(UTC)
doggy

Rank: Advanced Member

Groups: Registered
Joined: 12/27/2012(UTC)
Posts: 5,095
Belgium
Location: Belgium

Thanks: 284 times
Was thanked: 922 time(s) in 761 post(s)
Originally Posted by: john30120 Go to Quoted Post

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
john30120  
#5 Posted : Sunday, January 5, 2020 1:09:30 PM(UTC)
john30120

Rank: Member

Groups: Registered
Joined: 8/8/2019(UTC)
Posts: 24
United States
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.
thanks 1 user thanked john30120 for this useful post.
Kristoph on 6/28/2021(UTC)
doggy  
#6 Posted : Sunday, January 5, 2020 2:44:59 PM(UTC)
doggy

Rank: Advanced Member

Groups: Registered
Joined: 12/27/2012(UTC)
Posts: 5,095
Belgium
Location: Belgium

Thanks: 284 times
Was thanked: 922 time(s) in 761 post(s)
Originally Posted by: john30120 Go to Quoted Post


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.
Users browsing this topic
Guest
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.