Rank: Advanced Member
Groups: Registered
Joined: 2/18/2014(UTC) Posts: 1,837 Location: Stockholm
Thanks: 142 times Was thanked: 297 time(s) in 250 post(s)
|
Hi, I would like to have a script read some custom settings stored in a .txt file stored in the same folder as the .vmix and .config files (that contains the script). Whereas when Presets are opened vMix defaults to search for unfound files used for Inputs in that folder, I guess that there is no way to get the filePath to it in a vMix script? Please tell me that I am wrong... Side note, here is what ChatGPT offered me as the solution for parsing the content of the .txt file. Just had to remove the the Imports, Module, and Sub stuff and the script worked. Quote:Imports System.IO
Module Module1 Sub Main() ' Define your variables Dim varA As String Dim varB As String Dim varC As String
' Specify the path to your .txt file Dim filePath As String = "path\to\your\file.txt"
' Read all lines from the file Dim lines() As String = File.ReadAllLines(filePath)
' Process each line For Each line As String In lines ' Split the line into variable name and value Dim parts() As String = line.Split("="c)
' Check if the line is formatted correctly If parts.Length = 2 Then Dim variableName As String = parts(0).Trim() Dim variableValue As String = parts(1).Trim()
' Assign the value to the corresponding variable Select Case variableName Case "varA" varA = variableValue Case "varB" varB = variableValue Case "varC" varC = variableValue ' Add more cases for other variables if needed End Select Else ' Handle lines with incorrect format Console.WriteLine("Error: Line has incorrect format - " & line) End If Next
' Now, your variables varA, varB, and varC should have the values from the file Console.WriteLine("varA: " & varA) Console.WriteLine("varB: " & varB) Console.WriteLine("varC: " & varC)
' Optionally, you can do further processing or display the values as needed
Console.ReadLine() ' Keep console window open (press Enter to close) End Sub End Module
|
|
|
|
Rank: Advanced Member
Groups: Registered
Joined: 12/27/2012(UTC) Posts: 5,186 Location: Belgium Thanks: 288 times Was thanked: 946 time(s) in 781 post(s)
|
Originally Posted by: richardgatarski Hi, I would like to have a script read some custom settings stored in a .txt file stored in the same folder as the .vmix and .config files (that contains the script). the folder location of the loaded preset file can be found in the current API.XML For the location of scripts it depends if the scripts are local or general (within preset or config file) For the config file itself it is dependant on the version of vMix installed Quote: Whereas when Presets are opened vMix defaults to search for unfound files used for Inputs in that folder, I guess that there is no way to get the filePath to it in a vMix script? Please tell me that I am wrong...
? for the location of where they are supposed to be (yes they are in the presetfile) Code:Dim FileReader As System.IO.StreamReader
Dim InputLine As String
FileReader = System.IO.File.OpenText("d:/realine.txt")
InputLine = FileReader.ReadLine()
Do Until InputLine is Nothing
Console.WriteLine(InputLine)
'can do content of line manipulation here
InputLine = FileReader.ReadLine()
Loop
|
|
|
|
Rank: Advanced Member
Groups: Registered
Joined: 2/18/2014(UTC) Posts: 1,837 Location: Stockholm
Thanks: 142 times Was thanked: 297 time(s) in 250 post(s)
|
Originally Posted by: doggy the folder location of the loaded preset file can be found in the current API.XML Aarg! You got me there. When I tried I did not load a Preset, I just created a new one without saving it. I think that will make me an advanced member of Streaming Idiots... Thanks though doggy!
|
|
|
|
Rank: Advanced Member
Groups: Registered
Joined: 12/27/2012(UTC) Posts: 5,186 Location: Belgium Thanks: 288 times Was thanked: 946 time(s) in 781 post(s)
|
Originally Posted by: richardgatarski Originally Posted by: doggy the folder location of the loaded preset file can be found in the current API.XML Aarg! You got me there. When I tried I did not load a Preset, I just created a new one without saving it. I think that will make me an advanced member of Streaming Idiots... Thanks though doggy! LOL There is always the last.vmix preset that is automatically updated ;-) (every minute)
|
|
|
|
Rank: Newbie
Groups: Registered
Joined: 11/16/2023(UTC) Posts: 5 Location: Wisconsin
|
Originally Posted by: doggy Auto Play/Audio with Mix transitionsFor clearly stated reasons Mix transitions do not follow the general input rules of autoplay and audio. In the latest vMix video Tim gives some options using shortcuts and triggers. Here is another option example: There is no check to see if the Mix is in Output, in overlay or part of a multiview or even check on multiple Mix inputs in this script but are easely added if so needed. Am sure you can figure it out how to add ;-) And yes there will be a slight action delay if one uses other transitions than Cut in the Mix (obviously) This an auto variation of https://forums.vmix.com/...ng-for-Dummies#post97309Code:
dim MixNumber as string = "2"
dim oldactive as string = ""
dim Mactive as string = ""
dim Mpreview as string = ""
dim x as new system.xml.xmldocument
do while true
x.loadxml(API.XML())
Mactive = (x.SelectSingleNode("//mix[@number='" & MixNumber & "']/active/text()").InnerText)
Mpreview = (x.SelectSingleNode("//mix[@number='" & MixNumber & "']/preview/text()").InnerText)
if oldactive <> Mactive then
API.Function("Play",Input:=Mactive)
API.Function("AudioOn",Input:=Mactive)
API.Function("Pause",Input:=Mpreview)
API.Function("AudioOff",Input:=Mpreview)
oldactive = Mactive
end if
loop
Looking for some help with this script. I am using it to control the audio in Mix2 for when I am doing some PiP stuff. The script itself works great but my only issue is that the audio of the active input gets turned off when I transistion in my PiP input. I know that's because the input itself is transitioning out. As I switch through different inputs, the audio of the selected input it turned on, it's really that initial transition to Mix2 that is my issue. Is there something I am missing or is there another shortcut that I need to create in order to keep the audio on? For example... Camera 1 is the active input, audio is ON, and I want to transition to my PiP with camera 1. I transition in PiP input with camera 1 in mix2, audio on camera 1 turns OFF. When I transition to camera 2 in mix2, camera 2 audio turns ON. As I continue to switch through inputs the audio of the active input turns ON, as the script tells it to do. I just need that initial transition to keep the audio ON. Any help would be greatly appreciated.
|
|
|
|
Rank: Newbie
Groups: Registered
Joined: 1/25/2024(UTC) Posts: 1 Thanks: 1 times
|
Hey everyone, after studying this thread for hours and writing a few scripts by my own I came to the point where I can't find a solution for my problem. I want to know, which page of a title-input is active. I already figured out how to open a page Code:API.Function("TitleBeginAnimation", Input:= "Scoreboard", Value := "Page2")
or alternatively: Code:API.Function("SelectIndex", Input:= "Scoreboard", Value := "2")
but I am wondering how to find the active page. I need this to call a specific page under specific circumstances. In my case (it's for a tennis preset): while the first set show page 1, while the second set show page 2 and so on. Since I won't use it by myself but give the preset to external users, it has to be easy to handle and nearly unbreakable. That's why I don't want to use an additional Text as a counter, which I could call in the method. Any answers would be greatly appreciated!
|
|
|
|
Rank: Advanced Member
Groups: Registered
Joined: 12/27/2012(UTC) Posts: 5,186 Location: Belgium Thanks: 288 times Was thanked: 946 time(s) in 781 post(s)
|
Originally Posted by: Locke Hey everyone,
after studying this thread for hours and writing a few scripts by my own I came to the point where I can't find a solution for my problem.
I want to know, which page of a title-input is active.
Any answers would be greatly appreciated! There is no reference (API XML) that lets you know which page is currently active. You will have to create your own reference system . could use setting a dynamic value based on the page you called for and do a test (vb.net) on it Quote:Since I won't use it by myself but give the preset to external users, it has to be easy to handle and nearly unbreakable. That's why I don't want to use an additional Text as a counter, which I could call in the method.
vMix scripts are always accesible so unbreakable is not an option (unless one creates an external app ) How breakable a script is during use depends on how well a script is designed/written including failsafe tests, error catching etc and catering for any possible misuse (ie testing for any possible scenario)
|
|
|
|
Rank: Advanced Member
Groups: Registered
Joined: 12/27/2012(UTC) Posts: 5,186 Location: Belgium Thanks: 288 times Was thanked: 946 time(s) in 781 post(s)
|
Originally Posted by: Gary2theO
Looking for some help with this script. I am using it to control the audio in Mix2 for when I am doing some PiP stuff. The script itself works great but my only issue is that the audio of the active input gets turned off when I transistion in my PiP input. I know that's because the input itself is transitioning out. As I switch through different inputs, the audio of the selected input it turned on, it's really that initial transition to Mix2 that is my issue. Is there something I am missing or is there another shortcut that I need to create in order to keep the audio on?
For example...
Camera 1 is the active input, audio is ON, and I want to transition to my PiP with camera 1. I transition in PiP input with camera 1 in mix2, audio on camera 1 turns OFF. When I transition to camera 2 in mix2, camera 2 audio turns ON. As I continue to switch through inputs the audio of the active input turns ON, as the script tells it to do.
I just need that initial transition to keep the audio ON.
Any help would be greatly appreciated.
what are your automatic audio settings of your active input ?
|
|
|
|
Rank: Newbie
Groups: Registered
Joined: 11/16/2023(UTC) Posts: 5 Location: Wisconsin
|
Originally Posted by: doggy Originally Posted by: Gary2theO
Looking for some help with this script. I am using it to control the audio in Mix2 for when I am doing some PiP stuff. The script itself works great but my only issue is that the audio of the active input gets turned off when I transistion in my PiP input. I know that's because the input itself is transitioning out. As I switch through different inputs, the audio of the selected input it turned on, it's really that initial transition to Mix2 that is my issue. Is there something I am missing or is there another shortcut that I need to create in order to keep the audio on?
For example...
Camera 1 is the active input, audio is ON, and I want to transition to my PiP with camera 1. I transition in PiP input with camera 1 in mix2, audio on camera 1 turns OFF. When I transition to camera 2 in mix2, camera 2 audio turns ON. As I continue to switch through inputs the audio of the active input turns ON, as the script tells it to do.
I just need that initial transition to keep the audio ON.
Any help would be greatly appreciated.
what are your automatic audio settings of your active input ? All my inputs are set to auto mix.
|
|
|
|
Rank: Advanced Member
Groups: Registered
Joined: 12/27/2012(UTC) Posts: 5,186 Location: Belgium Thanks: 288 times Was thanked: 946 time(s) in 781 post(s)
|
Originally Posted by: Gary2theO Originally Posted by: doggy Originally Posted by: Gary2theO
Looking for some help with this script. I am using it to control the audio in Mix2 for when I am doing some PiP stuff. The script itself works great but my only issue is that the audio of the active input gets turned off when I transistion in my PiP input. I know that's because the input itself is transitioning out. As I switch through different inputs, the audio of the selected input it turned on, it's really that initial transition to Mix2 that is my issue. Is there something I am missing or is there another shortcut that I need to create in order to keep the audio on?
For example...
Camera 1 is the active input, audio is ON, and I want to transition to my PiP with camera 1. I transition in PiP input with camera 1 in mix2, audio on camera 1 turns OFF. When I transition to camera 2 in mix2, camera 2 audio turns ON. As I continue to switch through inputs the audio of the active input turns ON, as the script tells it to do.
I just need that initial transition to keep the audio ON.
Any help would be greatly appreciated.
what are your automatic audio settings of your active input ? All my inputs are set to auto mix.
|
|
|
|
Rank: Newbie
Groups: Registered
Joined: 11/17/2022(UTC) Posts: 3
Thanks: 1 times
|
Hi
Is it possible to get JSON data via API with authorisation via Brearer Token?
Thanks in advance!
|
|
|
|
Rank: Advanced Member
Groups: Registered
Joined: 2/18/2014(UTC) Posts: 1,837 Location: Stockholm
Thanks: 142 times Was thanked: 297 time(s) in 250 post(s)
|
Originally Posted by: David BCS Hi Is it possible to get JSON data via API with authorisation via Brearer Token? Thanks in advance! Search the Feature request forum.
|
1 user thanked richardgatarski for this useful post.
|
|
|
Rank: Advanced Member
Groups: Registered
Joined: 12/27/2012(UTC) Posts: 5,186 Location: Belgium Thanks: 288 times Was thanked: 946 time(s) in 781 post(s)
|
Trigger an action when a (long) transition has finished with approx remain time of transition discussion https://forums.vmix.com/postmessage?m=112773Its based on the transition settings on the vMix GUI, transition is called from within this script Mind you response time in the script editor console is slower than actual say display info in the title Code:' One of Transitions (1-4) set in the vMix GUI
dim vTransition as string = "Merge"
dim xml as string = API.XML()
dim x as new system.xml.xmldocument
x.loadxml(xml)
'Get the duration of the transition
Dim vDuration as string = x.SelectSingleNode("//transition[@effect='" & Vtransition & "']/@duration").Value
'Input that is currently active
Dim vActive as string = x.SelectSingleNode("//active").InnerText
Dim vElapsed As TimeSpan
Dim watch As Stopwatch = Stopwatch.StartNew()
'Execute the transition
API.Function(vTransition,duration:=vDuration )
Do While true
xml= API.XML()
x.loadxml(xml)
If x.SelectSingleNode("//preview").InnerText = vActive
' if preview becomes what was active the transition is done
console.writeline("Done")
API.Function("SetText",Input:=1,SelectedName:="Headline.Text" ,Value:="DONE")
Exit do
else
' a bit of countdon based on the transition duration (formula can be improved)
API.Function("SetText",Input:=1,SelectedName:="Headline.Text" ,Value:=(vDuration/1000) - Math.Floor(watch.Elapsed.TotalMilliseconds/1000) )
Console.WriteLine( vDuration/1000 - Math.Floor(watch.Elapsed.TotalMilliseconds/1000))
end if
' sleep(100)
Loop
|
|
|
|
Rank: Advanced Member
Groups: Registered
Joined: 4/2/2013(UTC) Posts: 53 Location: Hungary Thanks: 3 times
|
Hi everyone,
I would like to write the status of Overlay2 to variable.
Example: Status of Overlay2 = ON or OFF
Can I read the status? It is possible with VB.NET scripting?
Thank you.
|
|
|
|
Rank: Advanced Member
Groups: Registered
Joined: 12/27/2012(UTC) Posts: 5,186 Location: Belgium Thanks: 288 times Was thanked: 946 time(s) in 781 post(s)
|
Originally Posted by: videokommando Hi everyone,
I would like to write the status of Overlay2 to variable.
Example: Status of Overlay2 = ON or OFF
Can I read the status? Yes ( will tell you (if) which input is in overlay equals ON) Quote: It is possible with VB.NET scripting?
Yes Plenty of examples on how to get various info from the vMix API XML in this thread
|
|
|
|
Rank: Advanced Member
Groups: Registered
Joined: 4/2/2013(UTC) Posts: 53 Location: Hungary Thanks: 3 times
|
Originally Posted by: doggy Originally Posted by: videokommando Hi everyone,
I would like to write the status of Overlay2 to variable.
Example: Status of Overlay2 = ON or OFF
Can I read the status? Yes ( will tell you (if) which input is in overlay equals ON) Quote: It is possible with VB.NET scripting?
Yes Plenty of examples on how to get various info from the vMix API XML in this thread Thank you. Unfortunately I did not find the solution. I don't know what code to look for. The file name: is: title.gtzip Overlay: 2 How can I give a variable a true or false value?
|
|
|
|
Rank: Newbie
Groups: Registered
Joined: 3/17/2024(UTC) Posts: 4 Location: San Carlos Cojedes
|
Hello colleagues, I hope you are well... I have the following question...
It would be possible to make a script, I don't know if it already exists, can someone advise me since I'm new to scripts...
Does it allow me to place titles every time a data source is updated by XML? If I can explain myself correctly...
That every time the XML data source is updated, the title overlay is activated.
I hope you can help me... thank you very much
|
|
|
|
Rank: Advanced Member
Groups: Registered
Joined: 12/27/2012(UTC) Posts: 5,186 Location: Belgium Thanks: 288 times Was thanked: 946 time(s) in 781 post(s)
|
Originally Posted by: videokommando Originally Posted by: doggy Originally Posted by: videokommando Hi everyone,
I would like to write the status of Overlay2 to variable.
Example: Status of Overlay2 = ON or OFF
Can I read the status? Yes ( will tell you (if) which input is in overlay equals ON) Quote: It is possible with VB.NET scripting?
Yes Plenty of examples on how to get various info from the vMix API XML in this thread Thank you. Unfortunately I did not find the solution. I don't know what code to look for. The file name: is: title.gtzip Overlay: 2 How can I give a variable a true or false value? Code:dim x as new system.xml.xmldocument
dim TheOverlayOn as Boolean
dim ovl1input as string = ""
do while true
x.loadxml(API.XML())
ovl1input = (x.SelectSingleNode("//overlays//overlay[2]").InnerText)
if ovl1input > "0"
TheOverlayOn = True
else
TheOverlayOn = False
end if
Sleep(1000)
Loop
|
|
|
|
Rank: Advanced Member
Groups: Registered
Joined: 12/27/2012(UTC) Posts: 5,186 Location: Belgium Thanks: 288 times Was thanked: 946 time(s) in 781 post(s)
|
Originally Posted by: ajfnetwork Hello colleagues, I hope you are well... I have the following question...
It would be possible to make a script, I don't know if it already exists, can someone advise me since I'm new to scripts...
Does it allow me to place titles every time a data source is updated by XML? If I can explain myself correctly...
That every time the XML data source is updated, the title overlay is activated.
I hope you can help me... thank you very much Read content of title by reading the API XML or using the Input.Find() option Compare to a previously saved content , if different perform action , save new content for next comparison. Rinse and repeat PLS go through the multiple examples in this thread on how to read info from the api xml go through the multiple online tutorials on programming in vb.net
|
|
|
|
Rank: Advanced Member
Groups: Registered
Joined: 4/2/2013(UTC) Posts: 53 Location: Hungary Thanks: 3 times
|
Originally Posted by: doggy Code:dim x as new system.xml.xmldocument
dim TheOverlayOn as Boolean
dim ovl1input as string = ""
do while true
x.loadxml(API.XML())
ovl1input = (x.SelectSingleNode("//overlays//overlay[2]").InnerText)
if ovl1input > "0"
TheOverlayOn = True
else
TheOverlayOn = False
end if
Sleep(1000)
Loop
Thank you very much. Very useful help.
|
|
|
|
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