scripting_examples
Differences
This shows you the differences between two versions of the page.
Both sides previous revisionPrevious revisionNext revision | Previous revision | ||
scripting_examples [2024/05/13 13:14] – [initialise external output correctly at start-up (AUTOSTART)] peteraellig | scripting_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 725: | Line 725: | ||
< | < | ||
- | ===== 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:// | + | argb values and names can be found here\\ |
+ | [[https:// | ||
+ | |||
+ | <fc # | ||
+ | Example: #FF0000 becomes %23FF0000\\</ | ||
+ | |||
+ | 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, | ||
+ | |||
+ | |||
+ | ATTENTION: vmix uses colour for this command, not color\\ | ||
+ | \\ | ||
< | < | ||
- | ===== 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 # | ||
+ | Example: #FF0000 becomes %23FF0000\\</ | ||
+ | |||
+ | 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, | ||
+ | |||
+ | 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.\\ | ||
+ | |||
+ | < | ||
+ | dim textvalue as string | ||
+ | dim numericvalue as integer | ||
+ | |||
+ | Do While True | ||
+ | ' get text from title | ||
+ | textvalue = Input.Find(" | ||
+ | |||
+ | ' errorhandling, | ||
+ | Try | ||
+ | numericvalue = CInt(textvalue) ' | ||
+ | Catch ex As Exception | ||
+ | Console.WriteLine(" | ||
+ | ' errorhandling, | ||
+ | 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, | ||
+ | ' etc.... | ||
+ | |||
+ | If numericvalue = 10 Then | ||
+ | API.Function(" | ||
+ | ElseIf numericvalue = 20 Then | ||
+ | API.Function(" | ||
+ | ElseIf numericvalue = 30 Then | ||
+ | API.Function(" | ||
+ | End If | ||
+ | |||
+ | ' wait a little bit, that the script does not uses all of your cheap computers power :-) | ||
+ | Sleep(500) | ||
+ | Loop | ||
+ | </ | ||
+ | |||
+ | ===== 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 {{ :: | + | the title used in the example can be downloaded {{ :: |
- | {{: | + | {{: |
gets the color value of a shape in a gtzip-title: | gets the color value of a shape in a gtzip-title: |
scripting_examples.1715598877.txt.gz · Last modified: by peteraellig