VB.NET Scripting
vMix Scripting supports the powerful and easy to understand VB.NET language when writing your script.
Hello World Example
Consider the following vMix take on the infamous "Hello World" application:
Input.Find("NewsHD.xaml").Text("Headline") = "Hello World!" |
Or put another way:
dim i = Input.Find("NewsHD.xaml") i.Text("Headline") = "Hello World!" |
Both of these scripts do the same thing, that is to find the Title Input with name "NewsHD.xaml" and assign the "Headline" field with the text "Hello World!"
To try it out add the NewsHD.xaml title template to vMix and then run the script.
VB.NET
vMix Scripting supports the majority of VB.NET 2.0 code that will work within a single sub or function.
This means that custom classes and structures are not supported, however you can use the vast majority of the built in base classes in the .NET framework
including the handy System.Net.WebClient for downloading data over the internet.
vMix Objects
There are a number of built in objects that can be used from within vMix scripting:
Input
Shared Properties
Output As Input
Preview As Input
Find(inputNameNumberOrKey as String) As Input
Example:
Input.Preview.Function("Cut") |
Instance Properties
Text(Optional fieldName As String = "") As String
Change the text of a Field within an Title input, or read the current value
Instance Methods
Function(functionName As String, Optional value As String = "", Optional duration As Integer = 0, Optional selectedName As String = "", Optional selectedIndex As Integer = 0)
Function can be used to call any Shortcut function in vMix
WaitForCompletion(timeoutMilliseconds As Integer) As Boolean
Wait for a video to finish playing and return True, otherwise return False if timed out.
Overlay
Shared Properties
Find(number as Integer) As Overlay
Instance Methods
In(input as String)
Out
Off
Examples:
Overlay.Find(1).In("NewsHD.xaml") |
For i As Integer = 1 to 4 Overlay.Find(i).Off Next |
Console
Shared Methods
WriteLine(message as String)
Write the message string to the vMix Script console accessible from the Scripting tab of Settings.
This is useful for debugging purposes
Examples:
Console.WriteLine("Beginning Example Script") Overlay.Find(1).In("NewsHD.xaml") Console.WriteLine("Title should now appear in Overlay 1, now we wait 5 seconds") Sleep(5000) Console.WriteLine("Now we will transition out Overlay 1") Overlay.Find(1).Out Console.WriteLine("Finished!") |
API
Shared Methods
XML() As String
Returns the XML state of vMix as per the vMix Web API
Function(functionName As String, Optional input As String = "", Optional value As String = "", Optional duration As Integer = 0, Optional selectedName As String = "", Optional selectedIndex As Integer = 0)
Calls an API function as per the vMix Web API
Examples:
API.Function("CubeZoom",,1000) |