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
FrankLeggett  
#1 Posted : Monday, October 26, 2020 9:10:45 PM(UTC)
FrankLeggett

Rank: Advanced Member

Groups: Registered
Joined: 11/22/2018(UTC)
Posts: 94
United Kingdom
Location: Worthing

Thanks: 1 times
Was thanked: 4 time(s) in 3 post(s)
Hi,

I am looking for a bit of assistance to start coding scripts for VMix with VB.net. I have some exprience of using VB6 but I have no experience of using VB.net. In VB6 I write a program and then compile it as an exe file. Would I need to do this for a VB.net script for Vmix also. In the VB.net script would I have to pull in a reference for VMix?

Does someone have a very basic VB.net script they can put up for example fade between preview and program and advise how I would trigger this script. If it was a webscript I would just load it and run it in the settings but I don't think a vb.net script would be able to be run like this.

Sorry for the odd questions I am just trying to find a way into the scripting and how to trigger or run it.

any help would be greatfully appreciatied.

Frank
Peter1000  
#2 Posted : Monday, October 26, 2020 11:20:10 PM(UTC)
Peter1000

Rank: Advanced Member

Groups: Registered
Joined: 1/25/2019(UTC)
Posts: 284
Switzerland

Thanks: 16 times
Was thanked: 73 time(s) in 54 post(s)
First I would use the search function of the forum. This question has probably been asked 100 times already.
There is a good entry about scripting.
scripting for dummies
You do not have to import anything.
Under Settings scripting -> add script, you can create a new script. You can find examples in scripting for dummies.
This script can be assigned to a shortcut or a trigger.
Good luck
FrankLeggett  
#3 Posted : Monday, October 26, 2020 11:58:25 PM(UTC)
FrankLeggett

Rank: Advanced Member

Groups: Registered
Joined: 11/22/2018(UTC)
Posts: 94
United Kingdom
Location: Worthing

Thanks: 1 times
Was thanked: 4 time(s) in 3 post(s)
First of all thanks for the response. I have searched the forum and the scripting for dummies post is bookmarked on my computer. I have done basic web scripts in the add script section of the settings and got them to work. My confusion is if I instead write a simple vb.net script and save that as a .txt file then add that as a script in settings will Vmix recognise the VB.net content? Which is why I was looking for the simpliest of VB.net scripts that just faded Preview to Program so I could test how to run this in VMix.

What I'm basically saying is I have searched the forum and not found an answer I understand. It's a shame there isn't a VB.net scripting tutorial on the VMix YouTube page.
doggy  
#4 Posted : Tuesday, October 27, 2020 2:20:18 AM(UTC)
doggy

Rank: Advanced Member

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

Thanks: 284 times
Was thanked: 920 time(s) in 759 post(s)
Originally Posted by: FrankLeggett Go to Quoted Post
First of all thanks for the response. I have searched the forum and the scripting for dummies post is bookmarked on my computer. I have done basic web scripts in the add script section of the settings and got them to work. My confusion is if I instead write a simple vb.net script and save that as a .txt file then add that as a script in settings will Vmix recognise the VB.net content? Which is why I was looking for the simpliest of VB.net scripts that just faded Preview to Program so I could test how to run this in VMix.

What I'm basically saying is I have searched the forum and not found an answer I understand. It's a shame there isn't a VB.net scripting tutorial on the VMix YouTube page.


Hi Frank,

The reason there is not a vb.net tutorial from vMix is because its simple vb.net . Plenty of tutorials on the net regarding vb.net
The only limitation is you can not have your own sub functions or classes or add your own libraries, just plain vb.net logic like in the examples in scripting for dummies and other posts. But you have the addition of vMIx functions which are basically the same as shortcuts in terms of elements needed within a function

one types the code in the window ( settings-scripting) , save and let it execute .
As you probably noticed it looks like a basic text editor where you write the code so of course you can copy and paste code that you have written in any editor.
I do not understand where you get the save as text file and add as script from . vMix interprets the code written in its own little editor

The scripts you typed in and saved can be run by hitting the start button .
As you noticed you can name your script , very handy to call the script with a shortcut or a trigger.

Your Preview to Program script is a one liner vMix function but why would it have to be a function if you can do the same with a shortcut or trigger ?
The purpose of these scripting capabilities is to be able to handle some logic processing/decisions before performing one or the other function pretty much the same as you would have done in VB6 just written a bit differently ( its not another language but another dialect ;-) )
FrankLeggett  
#5 Posted : Tuesday, October 27, 2020 3:30:54 AM(UTC)
FrankLeggett

Rank: Advanced Member

Groups: Registered
Joined: 11/22/2018(UTC)
Posts: 94
United Kingdom
Location: Worthing

Thanks: 1 times
Was thanked: 4 time(s) in 3 post(s)
Thanks everyone, I have just pasted the VB.net "Hello World" script from the help page as a text file and have got this to work.

I have now progressed to trying to implement the "SelectIndex&Input" function for showing different pages from a Title.
I have it working as a WebScript: Function=SelectIndex&Input=Test.gtxml&Value=1&Index=1 (Change index value to change page) but I haven't managed to get it to work as a vb.net script, the nearest I have got is.
Api.Function("SelectIndex&Input", Input:="Text.gtxml", value=:"1",index="1") but if I change the value of index to "2" this doesn't work as it does with the WebScript.
dmwkr  
#6 Posted : Tuesday, October 27, 2020 5:40:46 AM(UTC)
dmwkr

Rank: Advanced Member

Groups: Registered
Joined: 2/23/2019(UTC)
Posts: 512

Thanks: 62 times
Was thanked: 119 time(s) in 108 post(s)
Originally Posted by: FrankLeggett Go to Quoted Post
Api.Function("SelectIndex&Input", Input:="Text.gtxml", value=:"1",index="1")


First, the name of the function is "SelectIndex", not "SelectIndex&Input". The "&" is the way of specifying parameters in web scripting. "Input" is the first parameter.

Second, that's three different notations you used on the three parameters in the script. Only the first one is correct. It's ":=" and not "=:" and not "=".

Third, according to https://www.vmix.com/hel...utFunctionReference.html there are only two parameters for the SelectIndex function: input and value.

Fourth, for numeric values (and, by the way, for variables) you don't use quotation marks. You only use them for strings. It might work anyways, but I don't think the quotation marks are necessary here.

Fifth, not sure, it probably won't hinder the script, but there are no spaces between the parameters.
FrankLeggett  
#7 Posted : Tuesday, October 27, 2020 7:37:23 PM(UTC)
FrankLeggett

Rank: Advanced Member

Groups: Registered
Joined: 11/22/2018(UTC)
Posts: 94
United Kingdom
Location: Worthing

Thanks: 1 times
Was thanked: 4 time(s) in 3 post(s)
Thanks dmwkr.

Ignore the := issues in the post as I did do them correctly in the script but copied them incorrectly in the post. I tried your suggestions and got it to work and here is the script for anyone else who wants it.

The scripts is for a title that has 6 pages and I want those pages to loop every 10 secs for a period of time no greater then 100 loops but probably less. I have also created 2 shortcuts using the "ScriptStart" and "ScriptStop" Function to control it's use.

dim x as integer
Dim Index as integer =0
Do while Index <=100
for x = 1 to 6
sleep(10000)
api.Function("SelectIndex",Input:="Test.gtxml",Value:=x)
next x
index +=1
loop
doggy  
#8 Posted : Tuesday, October 27, 2020 7:50:04 PM(UTC)
doggy

Rank: Advanced Member

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

Thanks: 284 times
Was thanked: 920 time(s) in 759 post(s)
:thumbsup:

maybe consider copying your last post/code to the Scripting for Dummies thread ;-)
Users browsing this topic
Similar Topics
vb.net scripting - first layer of input to preview (General Discussion)
by AdiA 7/12/2022 3:02:50 PM(UTC)
vMix VB.Net Scripting Environment Improvements (Feature Requests)
by engelschall 6/28/2022 3:59:28 AM(UTC)
Looking for occasional vb.net scripting (hourly or project-based) (3rd Party Software and Development)
by David_in_Philly 12/8/2020 1:16:17 PM(UTC)
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.