Rank: Advanced Member
Groups: Registered
Joined: 12/27/2012(UTC) Posts: 5,220 Location: Belgium Thanks: 291 times Was thanked: 953 time(s) in 788 post(s)
|
Originally Posted by: mirrormatt86 Originally Posted by: doggy 'Is a input Running or on Pause retrieved from the API xml dim xml = API.XML() dim x as new system.xml.xmldocument x.loadxml(xml) dim StateOf = (x.SelectSingleNode("//input[@type='Replay']/@state").Value) 'or dim StateOf = (x.SelectSingleNode("//input[@number='10']/@state").Value) Console.WriteLine(StateOf) so this results in an error. Great scripting "for dummies" And maybe you could explain when and what error you are getting and what your goal is ?
|
|
|
|
Rank: Member
Groups: Registered
Joined: 12/13/2022(UTC) Posts: 15
|
Originally Posted by: doggy Originally Posted by: mirrormatt86 Originally Posted by: doggy 'Is a input Running or on Pause retrieved from the API xml dim xml = API.XML() dim x as new system.xml.xmldocument x.loadxml(xml) dim StateOf = (x.SelectSingleNode("//input[@type='Replay']/@state").Value) 'or dim StateOf = (x.SelectSingleNode("//input[@number='10']/@state").Value) Console.WriteLine(StateOf) so this results in an error. Great scripting "for dummies" And maybe you could explain when and what error you are getting and what your goal is ? Didn’t see this. Don’t have notifications on. Am in the middle of the Australian outback. If you copy that script in to your vMix you’ll see that it returns either an invalid argument or an undefined error.
|
|
|
|
Rank: Advanced Member
Groups: Registered
Joined: 12/27/2012(UTC) Posts: 5,220 Location: Belgium Thanks: 291 times Was thanked: 953 time(s) in 788 post(s)
|
Originally Posted by: mirrormatt86 Originally Posted by: doggy Originally Posted by: mirrormatt86 Originally Posted by: doggy 'Is a input Running or on Pause retrieved from the API xml dim xml = API.XML() dim x as new system.xml.xmldocument x.loadxml(xml) dim StateOf = (x.SelectSingleNode("//input[@type='Replay']/@state").Value) 'or dim StateOf = (x.SelectSingleNode("//input[@number='10']/@state").Value) Console.WriteLine(StateOf) so this results in an error. Great scripting "for dummies" And maybe you could explain when and what error you are getting and what your goal is ? Didn’t see this. Don’t have notifications on. Am in the middle of the Australian outback. If you copy that script in to your vMix you’ll see that it returns either an invalid argument or an undefined error. You are right, my appologies for not explaining that snippits of code a lot of times do not apply to ones own setup correctly. - do you have a replay input or an input # 10 in your setup? - twice doing a "dim StatOff .." like here is wrong. Pik one or the other line of code ( or comment one out like the word "or" is) - its an example of how one can retrieve a status by refering by the input number or by the type of an input here (see diff in specifying) . Should have specified if one wanted a state of both such inputs one should/could use another variable name - those are examples , often even not the only way to achieve something by code - good catch, thank you
|
|
|
|
Rank: Newbie
Groups: Registered
Joined: 1/14/2023(UTC) Posts: 6 Location: Astana Thanks: 2 times
|
Hello ! I try to find a way for Add audio file as new input ( mp3 ) , but get file path from selected row of DataSource ( Excel table ) . My problem is how to get file path from DataSource.
Please Help )))
|
|
|
|
Rank: Advanced Member
Groups: Registered
Joined: 12/27/2012(UTC) Posts: 5,220 Location: Belgium Thanks: 291 times Was thanked: 953 time(s) in 788 post(s)
|
Originally Posted by: ferex.media Hello ! I try to find a way for Add audio file as new input ( mp3 ) , but get file path from selected row of DataSource ( Excel table ) . My problem is how to get file path from DataSource.
Please Help ))) Link the datasource to a (visually unused) title field read the content of the title field (the filepath) perfrom the function to load as input the gathered filepath
|
|
|
|
Rank: Newbie
Groups: Registered
Joined: 1/14/2023(UTC) Posts: 6 Location: Astana Thanks: 2 times
|
Originally Posted by: doggy
Link the datasource to a (visually unused) title field read the content of the title field (the filepath) perfrom the function to load as input the gathered filepath
How can I correctly read the content ? What command do it right. Also I think I need to assign this value to a any variable ?
|
|
|
|
Rank: Advanced Member
Groups: Registered
Joined: 12/27/2012(UTC) Posts: 5,220 Location: Belgium Thanks: 291 times Was thanked: 953 time(s) in 788 post(s)
|
Originally Posted by: ferex.media Originally Posted by: doggy
Link the datasource to a (visually unused) title field read the content of the title field (the filepath) perfrom the function to load as input the gathered filepath
How can I correctly read the content ? What command do it right. Also I think I need to assign this value to a any variable ? There are multiple examples on how to read from title and put results in a variable in this specific about scripting thread (17 pages) you posted this question in Good idea is to read thorugh this whole post/thread to learn about scripting
|
1 user thanked doggy for this useful post.
|
|
|
Rank: Newbie
Groups: Registered
Joined: 1/14/2023(UTC) Posts: 6 Location: Astana Thanks: 2 times
|
Script for get filepath from DataSource and Add that file as new Input and rename it.
dim track as string = Input.Find("TRACK").Text("Headline.Text") console.writeline(track) API.Function("AddInput",Value:="AudioFile|"&track)
dim xml as string = API.XML() dim x as new system.xml.xmldocument x.loadxml(xml)
dim nodeList as XmlNodeList = x.GetElementsByTagName("input") dim inputNumber as string for each node as XmlElement In nodeList inputNumber = node.GetAttribute("number") next console.Writeline("Last Input : " & inputNumber) API.Function("SetInputName",Input:=inputNumber,Value:="MUSIC " & inputNumber) API.Function("SetText",Input:="TRACK",SelectedIndex:="1" ,Value:="MUSIC " & inputNumber)
Great Thank for doggy !!!
|
|
|
|
Rank: Newbie
Groups: Registered
Joined: 1/14/2023(UTC) Posts: 6 Location: Astana Thanks: 2 times
|
Can I get the current number of raw of DataSource?
For create script - next player
|
|
|
|
Rank: Newbie
Groups: Registered
Joined: 1/14/2023(UTC) Posts: 6 Location: Astana Thanks: 2 times
|
How do You thing - Can I load API.XML file of other VMIX at the same network ?
|
|
|
|
Rank: Advanced Member
Groups: Registered
Joined: 12/27/2012(UTC) Posts: 5,220 Location: Belgium Thanks: 291 times Was thanked: 953 time(s) in 788 post(s)
|
Originally Posted by: ferex.media How do You thing - Can I load API.XML file of other VMIX at the same network ? refer to the correct IP of the machine
|
|
|
|
Rank: Advanced Member
Groups: Registered
Joined: 12/27/2012(UTC) Posts: 5,220 Location: Belgium Thanks: 291 times Was thanked: 953 time(s) in 788 post(s)
|
Originally Posted by: ferex.media Can I get the current number of raw of DataSource?
No (would need to handle your datasource externally coded Quote: For create script - next player
please read the documentation "Shortcut Function Reference" DataSourceNextRow
|
|
|
|
Rank: Member
Groups: Registered
Joined: 12/13/2022(UTC) Posts: 15
|
Code:
dim xml as string = API.XML()
dim x as new system.xml.xmldocument
x.loadxml(xml)
'set the name of your list
dim SI = (x.SelectSingleNode("//input[@shortTitle='Wowsers']/@selectedIndex").Value)
'set the numbers of your list items and decide what to do
If SI = "14" Then
API.Function("Selectindex", Value:="1", Input:="Wowsers")
ElseIf SI < 14 Then
API.Function("NextItem", Input:="1")
End if
Only works if 'Wowsers' is the first item in the preset. (Put any source in front of it and it does not work, does not error out)
|
|
|
|
Rank: Advanced Member
Groups: Registered
Joined: 12/24/2021(UTC) Posts: 474 Location: athens Thanks: 118 times Was thanked: 68 time(s) in 64 post(s)
|
Originally Posted by: mirrormatt86 Code:
dim xml as string = API.XML()
dim x as new system.xml.xmldocument
x.loadxml(xml)
'set the name of your list
dim SI = (x.SelectSingleNode("//input[@shortTitle='Wowsers']/@selectedIndex").Value)
'set the numbers of your list items and decide what to do
If SI = "14" Then
API.Function("Selectindex", Value:="1", Input:="Wowsers")
ElseIf SI < 14 Then
API.Function("NextItem", Input:="1")
End if
Only works if 'Wowsers' is the first item in the preset. (Put any source in front of it and it does not work, does not error out) "NextItem", Input:="1" -->try to change also this value either to name you give or input number of list
|
|
|
|
Rank: Newbie
Groups: Registered
Joined: 4/7/2021(UTC) Posts: 5 Location: Moscow
Thanks: 3 times
|
Hello! Is it possible to get a state on\off layer-N of input-N? In xml i see only key of some input in layer but i dont know state of layer.
|
|
|
|
Rank: Advanced Member
Groups: Registered
Joined: 12/27/2012(UTC) Posts: 5,220 Location: Belgium Thanks: 291 times Was thanked: 953 time(s) in 788 post(s)
|
Originally Posted by: Black Dog Hello! Is it possible to get a state on\off layer-N of input-N? In xml i see only key of some input in layer but i dont know state of layer. Can find that state in the Last.vmix preset file (maybe in named preset file also) . Mind you this Last.vmix preset file autoupdates only every minute
|
|
|
|
Rank: Newbie
Groups: Registered
Joined: 4/7/2021(UTC) Posts: 5 Location: Moscow
Thanks: 3 times
|
Thanks, Doggy! That states for all inputs must be in preset if preset is stored and last preset. But to get one is hard from preset. I have two ways to get one, but those are not good ideas, I think other ways are.
1) input Layer1 -on Layer2-none Layer3-off Layer4-none After changing state of each layer change a name input as state layer On-1, Off-0, None-3 Rename input - 1303 I can’t use input by name, I can use it only by key. I have to give the name for input manually the first time and this is not quite right. All scripts change state layers must rename inputs.
2) In other way write states to a file. Make file and write state layers by all scripts which can change state layers. Should write inputs manually the first time.
|
|
|
|
Rank: Advanced Member
Groups: Registered
Joined: 12/27/2012(UTC) Posts: 5,220 Location: Belgium Thanks: 291 times Was thanked: 953 time(s) in 788 post(s)
|
Originally Posted by: Black Dog Thanks, Doggy! That states for all inputs must be in preset if preset is stored and last preset. But to get one is hard from preset.
Not really , they are xml files (some items are strings that contain xml code of thei own-) )
|
|
|
|
Rank: Advanced Member
Groups: Registered
Joined: 11/15/2021(UTC) Posts: 72 Thanks: 8 times Was thanked: 9 time(s) in 7 post(s)
|
Originally Posted by: Black Dog Hello! Is it possible to get a state on\off layer-N of input-N? In xml i see only key of some input in layer but i dont know state of layer. maybe this workaround will help. Instead of switch the layer on/off you can change the Layer Input to "none" (with shortcuts) and then check the status with a script. somethings like: Code:dim Input1Layer1on as string = ""
dim Input1Layer1on_exists as string = "yes"
try
Input1Layer1on = (x.SelectSingleNode("//input[@number='"& Input1name &"']/overlay[@index='0']/@key").value)
Catch ex as Exception
Input1Layer1on_exists = "no"
end try
if Input1Layer1on_exists = "yes" then...do something crazy
|
1 user thanked Salvatore for this useful post.
|
|
|
Rank: Newbie
Groups: Registered
Joined: 4/7/2021(UTC) Posts: 5 Location: Moscow
Thanks: 3 times
|
Thanks, Salvatore! All layers turn On. Then "OFF" as "Set_Layer_NONE" and "ON" as Set_Layer_SomeInput. That is good idea. Well, I need to rewrite all the scripts (((( with new idea. Sorry, in code - Input_number as Numder or Input_name as Title. Somebody can copy code and VB_Try hides typing error ))) Originally Posted by: Salvatore Code:
Input1Layer1on = (x.SelectSingleNode("//input[@number='"& Input1name &"']/overlay[@index='0']/@key").value)
|
|
|
|
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