User Tools

Site Tools


scripting_examples

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revisionPrevious revision
Next revision
Previous revision
scripting_examples [2024/05/13 13:01] – [vMix Befehle in einer bestimmten Zeitabfolge vorgegebener Zeiten] peteraelligscripting_examples [2024/10/04 09:27] (current) – [Fetches the color of a shape from a GTtitle and then performs an action based on the color] peteraellig
Line 191: Line 191:
 </code> </code>
 ===== Cut input to one of the outputs ===== ===== Cut input to one of the outputs =====
-As of version 25, vMix has up to 16 so-called mix inputs (Aux or M/E) more than just the output (Mix1 or Mix0 in the API) These can then be routed to other outputs. (max. 6 outputs in vMix) So also set Mix! From version 27, more than two EXTERNAL OUTPUTS can be set, depending on the performance of the computer. From a QUADRO RTX 4000, 4 work perfectly. From the GeFroce RTX models of the 3000 series, more will also work. However, if the computer is still making slow or massive recordings, then I would only access these functions with a new A series card.+As of version 26, vMix has up to 16 so-called mix inputs (Aux or M/E) more than just the output (Mix1 or Mix0 in the API) These can then be routed to other outputs. (max. 6 outputs in vMix) So also set Mix! From version 27, more than two EXTERNAL OUTPUTS can be set, depending on the performance of the computer. From a QUADRO RTX 4000, 4 work perfectly. From the GeFroce RTX models of the 3000 series, more will also work. However, if the computer is still making slow or massive recordings, then I would only access these functions with a new A series card.
  
 Input4 Video route to OUTPUT \\ Input4 Video route to OUTPUT \\
Line 725: Line 725:
 <code>http://127.0.0.1:8088/api/?Function=SetText&Input=Title 0- The Classic Blue.gtzip&SelectedName=Headline.Text&Value=Text changed")</code> <code>http://127.0.0.1:8088/api/?Function=SetText&Input=Title 0- The Classic Blue.gtzip&SelectedName=Headline.Text&Value=Text changed")</code>
  
-===== Changes the font colour of a specific text field =====+===== Changes the font colour of a specific text field (SetTextColour)  =====
 There go argb values or valid names for a colour (red, blue, black, transparent etc.) There go argb values or valid names for a colour (red, blue, black, transparent etc.)
-argb values and names can be found here [[https://www.w3schools.com/colors/colors_names.asp]]+argb values and names can be found here\\ 
 +[[https://www.w3schools.com/colors/colors_names.asp]]\\ 
 + 
 +<fc #cd5c5c>ATTENTION: if you send the command via HTTP API, replace the # character with %23.\\ 
 +Example: #FF0000 becomes %23FF0000\\</fc> 
 + 
 +You can use HEX rgba values for one color\\ 
 +SAMPLE: rgba(red, green, blue, alpha)\\ 
 + 
 +#FF0000 for red 100% visible\\ 
 +#FF00007F for red 50% transparent, 00 = transparent, FF = 100% visible\\ 
 + 
 + 
 +ATTENTION: vmix uses colour for this command, not color\\ 
 +\\
 <code>API.Function("SetTextColour",Input:="whoisonair.gtzip",SelectedName:="hg21.Text",Value:="transparent")</code>\\ <code>API.Function("SetTextColour",Input:="whoisonair.gtzip",SelectedName:="hg21.Text",Value:="transparent")</code>\\
  
-===== Changes shape color of a specific shape, e.g. a circle or a rectangle(Setcolor) =====+===== Changes the font colour of a specific text field depending on a numerical value (SetTextColour)===== 
 + 
 +<fc #cd5c5c>ATTENTION: if you send the command via HTTP API, replace the # character with %23.\\ 
 +Example: #FF0000 becomes %23FF0000\\</fc> 
 + 
 +You can use HEX rgba values for one color\\ 
 +SAMPLE: rgba(red, green, blue, alpha)\\ 
 + 
 +#FF0000 for red 100% visible\\ 
 +#FF00007F for red 50% transparent, 00 = transparent, FF = 100% visible\\ 
 + 
 +If a text field displays a certain value, the text colour is changed with this script. This can be the text colour of the text field that displays the value or a different one.\\ 
 +The script example uses the title ‘Title 0- The Classic Blue.gtzip’ contained in vMix. Change the title name and the field from which you want to get the numerical value and the field from which you want to change the colour.\\ 
 + 
 +<code> 
 +dim textvalue as string 
 +dim numericvalue as integer 
 + 
 +Do While True 
 +    ' get text from title 
 +    textvalue = Input.Find("Title 0- The Classic Blue.gtzip").Text("Headline.Text"
 + 
 +    ' errorhandling, if in the textfield is a non numeric value 
 +    Try 
 +        numericvalue = CInt(textvalue) 'convert the string to a number 
 +    Catch ex As Exception 
 +        Console.WriteLine("Error: " & ex.Message) 
 +        ' errorhandling, sets numericvalue to a save value 
 +        numericvalue = -1 
 +    End Try 
 + 
 +    ' depending on a value, it changes the color of the text 
 +    ' you can use any logical funktion like: 
 +    ' If numericvalue < 10 Then 
 +    ' If numericvalue > 10 Then 
 +    ' If numericvalue < 100 Or numericvalue > 200 Then (all from 100 to 199) 
 +    ' If numericvalue Mod 2 = 0 Then  (only even number) 
 +    ' If numericvalue Mod 10 = 0 Then (only 10,20,30....) 
 +    ' etc.... 
 +     
 +    If numericvalue = 10 Then 
 +        API.Function("SetTextColour", Input:="Title 0- The Classic Blue.gtzip", Value:="#FF0000", SelectedName:="Description.Text"
 +    ElseIf numericvalue = 20 Then 
 +        API.Function("SetTextColour", Input:="Title 0- The Classic Blue.gtzip", Value:="#FFFF00", SelectedName:="Description.Text"
 +    ElseIf numericvalue = 30 Then 
 +        API.Function("SetTextColour", Input:="Title 0- The Classic Blue.gtzip", Value:="#FFFFFF", SelectedName:="Description.Text"
 +    End If 
 + 
 +    ' wait a little bit, that the script does not uses all of your cheap computers power :-) 
 +    Sleep(500) 
 +Loop 
 +</code>\\ 
 + 
 +===== Changes shape color of a specific shape, e.g. a circle or a rectangle (Setcolor) =====
 Changes shape color of a specific shape, e.g. a circle or a rectangle) (Setcolor) Changes shape color of a specific shape, e.g. a circle or a rectangle) (Setcolor)
  
Line 754: Line 821:
  
 This is a script that shows how to read the color of a shape from a title and then perform an action based on the color. The script must be started and runs in the background as a loop.  This is a script that shows how to read the color of a shape from a title and then perform an action based on the color. The script must be started and runs in the background as a loop. 
-the title used in the example can be downloaded {{ ::textshape.gtzip |here}}. +the title used in the example can be downloaded {{ ::textshape.gtzip |here}}.\\ 
-{{:gsc3.jpg?200|}}\\+{{:gsc3.jpg?600|}}\\
  
 gets the color value of a shape in a gtzip-title:\\ gets the color value of a shape in a gtzip-title:\\
Line 1969: Line 2036:
  
 ====== MIX Funktionen ====== ====== MIX Funktionen ======
-===== Mixer Input ===== +===== Mixer Input (or AUX BUS) ===== 
-vMix has 3 additional small mixer inputs, which can also be used well for various script-controlled functions. The advantage of the additional mixers is that each input can also be blended. (The mixers are only available from the 4K version)+vMix still has (from version 26) 16 small mixer inputs, which can also be used for various script-controlled functions. The advantage of the additional mixers is that each input can also be blended. (The mixers are only available from the 4K version onwards)\\ 
 +<fs x-large><fc #ff0000>Here again, Mix=0 is the OUTPUT/PGM, Mix=1 is the first input MIX, which is then labeled Mix2 in the small preview window.... Confusing, but that's how it is.</fc></fs>
  
 A mixer input is generated with the small up arrow next to the Add Input button.\\ A mixer input is generated with the small up arrow next to the Add Input button.\\
Line 2126: Line 2194:
  
 ====== initialise external output correctly at start-up (AUTOSTART) ====== ====== initialise external output correctly at start-up (AUTOSTART) ======
 +Since Blackmagic Decklink cards do not initialize correctly in vMix, you MUST switch external output on and off 3 times for safety. vMix is aware of this problem, but is obviously not able to solve the problem on their side.
 +
 This requires a script and a web browser input in EVERY project. When the project is started, the website is called once. Since a vMix API command can also be sent via the web browser, this command triggers the script.  This requires a script and a web browser input in EVERY project. When the project is started, the website is called once. Since a vMix API command can also be sent via the web browser, this command triggers the script. 
 +
 +
  
 The web browser INPUT has the following URL:\\ The web browser INPUT has the following URL:\\
Line 2133: Line 2205:
 The following script with the name "startexternal" must be present on the computer:\\ The following script with the name "startexternal" must be present on the computer:\\
 <code> <code>
 +API.Function("StartExternal")
 +sleep (1000)
 +API.Function("StopExternal")
 +sleep (1000)
 API.Function("StartExternal") API.Function("StartExternal")
 sleep (1000) sleep (1000)
scripting_examples.1715598096.txt.gz · Last modified: by peteraellig

Donate Powered by PHP Valid HTML5 Valid CSS Driven by DokuWiki