Rank: Advanced Member
Groups: Registered
Joined: 11/22/2018(UTC) Posts: 94 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
|
|
|
|
Rank: Advanced Member
Groups: Registered
Joined: 1/25/2019(UTC) Posts: 302 Thanks: 17 times Was thanked: 79 time(s) in 60 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 dummiesYou 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
|
|
|
|
Rank: Advanced Member
Groups: Registered
Joined: 11/22/2018(UTC) Posts: 94 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.
|
|
|
|
Rank: Advanced Member
Groups: Registered
Joined: 12/27/2012(UTC) Posts: 5,216 Location: Belgium Thanks: 291 times Was thanked: 955 time(s) in 790 post(s)
|
Originally Posted by: FrankLeggett 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 ;-) )
|
|
|
|
Rank: Advanced Member
Groups: Registered
Joined: 11/22/2018(UTC) Posts: 94 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.
|
|
|
|
Rank: Advanced Member
Groups: Registered
Joined: 2/23/2019(UTC) Posts: 555
Thanks: 62 times Was thanked: 130 time(s) in 118 post(s)
|
Originally Posted by: FrankLeggett 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.
|
|
|
|
Rank: Advanced Member
Groups: Registered
Joined: 11/22/2018(UTC) Posts: 94 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
|
|
|
|
Rank: Advanced Member
Groups: Registered
Joined: 12/27/2012(UTC) Posts: 5,216 Location: Belgium Thanks: 291 times Was thanked: 955 time(s) in 790 post(s)
|
:thumbsup:
maybe consider copying your last post/code to the Scripting for Dummies thread ;-)
|
|
|
|
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