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
mikeborschow  
#1 Posted : Monday, May 24, 2021 4:32:00 AM(UTC)
mikeborschow

Rank: Member

Groups: Registered
Joined: 11/2/2014(UTC)
Posts: 16
Location: Dallas TX

Thanks: 4 times
Was thanked: 4 time(s) in 3 post(s)
It would be very helpful if there was a way to pass a variable from the RESTful API to a script.

For example in the URL that calls the script, would look something like this:
http://127.0.0.1:8088/API/?Function=StartScript&Value=ScriptName&Var1=ThisIsVariableNumber1Value&Var2=ThisIsSecondVarValue

Then maybe inside the script there would be some sort of reference for the variables such as:

API.Function("ListAdd",Input:="1",Value:=%Var1%)

Would open up several possibilities.

THANKS!
doggy  
#2 Posted : Monday, May 24, 2021 5:44:41 AM(UTC)
doggy

Rank: Advanced Member

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

Thanks: 293 times
Was thanked: 955 time(s) in 790 post(s)
Have you checked out using dynamic inputs and values for passing variables?
mikeborschow  
#3 Posted : Monday, May 24, 2021 6:34:25 AM(UTC)
mikeborschow

Rank: Member

Groups: Registered
Joined: 11/2/2014(UTC)
Posts: 16
Location: Dallas TX

Thanks: 4 times
Was thanked: 4 time(s) in 3 post(s)
Originally Posted by: doggy Go to Quoted Post
Have you checked out using dynamic inputs and values for passing variables?


Yes, we have checked out those new features in v24.

We are producing semi-automated yet very dynamic transactional live events. Our goal is to send an efficient command to vMix and allow our scripts within to do the heavy lifting. Our current option is to use ScriptStartDynamic, however, it is somewhat inefficient as it requires that we dynamically write the entire script outside of vMix and then send a very long URL to have it execute. It would be so much better to have the script in vMix and simply send the variables with a trigger to start.

We really favor sending a command once vs. sending multiple commands to accomplish a task.

Open to ideas, but keeping fingers crossed that Martin and the vMix team will come up with a method to pass variables into a script.

Regards,
-Mike B.
doggy  
#4 Posted : Monday, May 24, 2021 7:54:18 AM(UTC)
doggy

Rank: Advanced Member

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

Thanks: 293 times
Was thanked: 955 time(s) in 790 post(s)
Originally Posted by: mikeborschow Go to Quoted Post
but keeping fingers crossed that Martin and the vMix team will come up with a method to pass variables into a script.


That's exactly what the dynamic value can be used ( and were FR'ed ) for , can even insert a xml structure in it

Why not just set the value in the dynamic value for the called script to read , could even be a reference to say a text file for a script to take on , even a whole script in said textfile

Granted , i have no idea what exactly you want to achieve but i seems to me a change of logic for the scripting and variable might be on order



Papo  
#5 Posted : Monday, May 24, 2021 9:47:42 AM(UTC)
Papo

Rank: Advanced Member

Groups: Registered
Joined: 6/16/2020(UTC)
Posts: 77
Peru

Thanks: 8 times
Was thanked: 2 time(s) in 2 post(s)
exact dynamic values for those with version 24,
but tell me doggy you can use title input to save values and scripts read that title value, right?
translated from spanish to english by google
mikeborschow  
#6 Posted : Monday, May 24, 2021 10:49:25 AM(UTC)
mikeborschow

Rank: Member

Groups: Registered
Joined: 11/2/2014(UTC)
Posts: 16
Location: Dallas TX

Thanks: 4 times
Was thanked: 4 time(s) in 3 post(s)
Originally Posted by: doggy Go to Quoted Post


Why not just set the value in the dynamic value for the called script to read , could even be a reference to say a text file for a script to take on , even a whole script in said textfile



We don't know how this works, please explain. Let's say for example that we want to load a video for a background that is part of a multi layer input. The script is going to build the multi layer input with all the proper elements. We need to tell the script the file to use for the video. Let's also assume we will provide a few variables for the text information and a sleep time (example 5000 for 5 seconds) for running other events as part of the script.

Using Dynamic Values, how will we send those variables to the script? Again, as stated previously, we're not really interested in creating an XML or Text file first and then asking vMix to read that file, we just want to send the necessary data directly to the script via the RESTful API call.

Can you please provide an example? How would we pass 5 different variables to the script using Dynamic Values?

Would we be limited to only 4 scripts?

Thanks in advance for your advice.
doggy  
#7 Posted : Monday, May 24, 2021 4:34:36 PM(UTC)
doggy

Rank: Advanced Member

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

Thanks: 293 times
Was thanked: 955 time(s) in 790 post(s)
Originally Posted by: Papo Go to Quoted Post
exact dynamic values for those with version 24,
but tell me doggy you can use title input to save values and scripts read that title value, right?
translated from spanish to english by google


Yes you can and is often done
doggy  
#8 Posted : Monday, May 24, 2021 5:47:39 PM(UTC)
doggy

Rank: Advanced Member

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

Thanks: 293 times
Was thanked: 955 time(s) in 790 post(s)
Originally Posted by: mikeborschow Go to Quoted Post
Originally Posted by: doggy Go to Quoted Post

Why not just set the value in the dynamic value for the called script to read , could even be a reference to say a text file for a script to take on , even a whole script in said textfile


We don't know how this works, please explain.


Aha
Research and learn! Not dismiss!

Quote:

Let's say for example that we want to load a video for a background that is part of a multi layer input. The script is going to build the multi layer input with all the proper elements. We need to tell the script the file to use for the video. Let's also assume we will provide a few variables for the text information and a sleep time (example 5000 for 5 seconds) for running other events as part of the script.


How were you going to provide ( or get from) the details for the variables in the first place ?
Data sources comes to mind for example , all details per row of the list

BTW: your in for a treat with loading/adding inputs to use to build a MV without preloads and existing inputs ( i would rethink this path)


Quote:

Using Dynamic Values, how will we send those variables to the script? Again, as stated previously, we're not really interested in creating an XML or Text file first and then asking vMix to read that file, we just want to send the necessary data directly to the script via the RESTful API call.



Again , are you going to manually enter the value details? Where will you get them from during the production? how will you control that? typing , pressing buttons? how ?

Why fixate on http calls and not let a script make decisions and execute accordingly. scripts can be just one line but also a whole program and can call others etc
Or one can write an external app to make defining and sending the variables more practically. What's your actual workflow?


Quote:

Can you please provide an example? How would we pass 5 different variables to the script using Dynamic Values?
Would we be limited to only 4 scripts?


I already mentioned data sources but if using a dynamic value one can build a structure in this (1) value containing all the elements
vMix has function to write and read these dynamic values, extract details etc

example:
?t=1123

Do not assume anything when defining a script (program) , make a logical flow!

Suggest to read through
https://forums.vmix.com/...86-Scripting-for-Dummies

While the initial FR is interesting i do not believe it is going to solve your intentions

But if you insist

http://127.0.0.1:8088/api/?Function=SetDynamicValue1&Value=A,B,C
http://127.0.0.1:8088/API/?Function=ScriptStart&Value=ScriptName

In the called script read the DynamicValue1 ( from the API XML) , split the values (on ",") and do whatever you want with those values into functions or whatever
thanks 1 user thanked doggy for this useful post.
mikeborschow on 5/29/2021(UTC)
mikeborschow  
#9 Posted : Saturday, May 29, 2021 10:27:13 AM(UTC)
mikeborschow

Rank: Member

Groups: Registered
Joined: 11/2/2014(UTC)
Posts: 16
Location: Dallas TX

Thanks: 4 times
Was thanked: 4 time(s) in 3 post(s)
Doggy, can I send xml instead of a comma delimited list? Then somehow parse the xml?
mikeborschow  
#10 Posted : Saturday, May 29, 2021 10:28:51 AM(UTC)
mikeborschow

Rank: Member

Groups: Registered
Joined: 11/2/2014(UTC)
Posts: 16
Location: Dallas TX

Thanks: 4 times
Was thanked: 4 time(s) in 3 post(s)
Originally Posted by: doggy Go to Quoted Post
Originally Posted by: mikeborschow Go to Quoted Post
Originally Posted by: doggy Go to Quoted Post

Why not just set the value in the dynamic value for the called script to read , could even be a reference to say a text file for a script to take on , even a whole script in said textfile


We don't know how this works, please explain.


Aha
Research and learn! Not dismiss!

Quote:

Let's say for example that we want to load a video for a background that is part of a multi layer input. The script is going to build the multi layer input with all the proper elements. We need to tell the script the file to use for the video. Let's also assume we will provide a few variables for the text information and a sleep time (example 5000 for 5 seconds) for running other events as part of the script.


How were you going to provide ( or get from) the details for the variables in the first place ?
Data sources comes to mind for example , all details per row of the list

BTW: your in for a treat with loading/adding inputs to use to build a MV without preloads and existing inputs ( i would rethink this path)


Quote:

Using Dynamic Values, how will we send those variables to the script? Again, as stated previously, we're not really interested in creating an XML or Text file first and then asking vMix to read that file, we just want to send the necessary data directly to the script via the RESTful API call.



Again , are you going to manually enter the value details? Where will you get them from during the production? how will you control that? typing , pressing buttons? how ?

Why fixate on http calls and not let a script make decisions and execute accordingly. scripts can be just one line but also a whole program and can call others etc
Or one can write an external app to make defining and sending the variables more practically. What's your actual workflow?


Quote:

Can you please provide an example? How would we pass 5 different variables to the script using Dynamic Values?
Would we be limited to only 4 scripts?


I already mentioned data sources but if using a dynamic value one can build a structure in this (1) value containing all the elements
vMix has function to write and read these dynamic values, extract details etc

example:
?t=1123

Do not assume anything when defining a script (program) , make a logical flow!

Suggest to read through
https://forums.vmix.com/...86-Scripting-for-Dummies

While the initial FR is interesting i do not believe it is going to solve your intentions

But if you insist

http://127.0.0.1:8088/api/?Function=SetDynamicValue1&Value=A,B,C
http://127.0.0.1:8088/API/?Function=ScriptStart&Value=ScriptName

In the called script read the DynamicValue1 ( from the API XML) , split the values (on ",") and do whatever you want with those values into functions or whatever


Doggy, can I send xml instead of a comma delimited list? Then somehow parse the xml?
doggy  
#11 Posted : Saturday, May 29, 2021 4:32:11 PM(UTC)
doggy

Rank: Advanced Member

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

Thanks: 293 times
Was thanked: 955 time(s) in 790 post(s)
Originally Posted by: mikeborschow Go to Quoted Post
Doggy, can I send xml instead of a comma delimited list? Then somehow parse the xml?


Sure, what do you think reading the API XML is doing in a script ?
or if you mean as dynamic value, that is what is done in the video i linked to

https://www.google.com/s...ceid=chrome&ie=UTF-8
derrickrhems  
#12 Posted : Tuesday, April 19, 2022 9:40:54 AM(UTC)
derrickrhems

Rank: Newbie

Groups: Registered
Joined: 9/6/2020(UTC)
Posts: 3
United States
Location: Dalzell

Originally Posted by: doggy Go to Quoted Post
Originally Posted by: Papo Go to Quoted Post
exact dynamic values for those with version 24,
but tell me doggy you can use title input to save values and scripts read that title value, right?
translated from spanish to english by google


Yes you can and is often done


Can you point me to a post that shows how this is done. I have looked high and low. Please and thanks for your help.
Users browsing this topic
Guest (5)
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.