Rank: Member
Groups: Registered
Joined: 7/15/2021(UTC) Posts: 11 Location: Mashhad Thanks: 5 times
|
Hi I have a play list of items. I want to overlay an input every time that one of specific item plays in my list and if that one is not play turn the overlay off. I'm not good at scripting but I used the blow code: Code:dim xml as string = API.XML()
dim GetInputNumber as string = ""
dim GetInputName as string = ""
dim x as new system.xml.xmldocument
x.loadxml(xml)
GetInputNumber = (x.SelectSingleNode("/vmix/active").InnerText)
GetInputName = (x.SelectSingleNode("//input[@number='"& GetInputNumber &"']/@title").Value)
do while true
if GetInputName = "List - B" then
sleep (500)
API.Function("OverlayInput1In", Input:="2")
else
API.Function("OverlayInput1out")
end if
sleep (500)
loop
My problem is this code works one time and not work every time But my playlist is in the loop.
|
|
|
|
Rank: Advanced Member
Groups: Registered
Joined: 12/27/2012(UTC) Posts: 5,243 Location: Belgium Thanks: 294 times Was thanked: 960 time(s) in 794 post(s)
|
Originally Posted by: Ham4u62 Hi
I have a play list of items. I want to overlay an input every time that one of specific item plays in my list and if that one is not play turn the overlay off. I'm not good at scripting but I used the blow code:
dim xml as string = API.XML() dim GetInputNumber as string = "" dim GetInputName as string = ""
dim x as new system.xml.xmldocument x.loadxml(xml)
GetInputNumber = (x.SelectSingleNode("/vmix/active").InnerText) GetInputName = (x.SelectSingleNode("//input[@number='"& GetInputNumber &"']/@title").Value)
do while true if GetInputName = "List - B" then
sleep (500) API.Function("OverlayInput1In", Input:="2")
else
API.Function("OverlayInput1out")
end if sleep (500) loop
My problem is this code works one time and not work every time But my playlist is in the loop.
GetInputName is never (able) to change within the loop ie the IF has always the same result !
|
1 user thanked doggy for this useful post.
|
|
|
Rank: Member
Groups: Registered
Joined: 7/15/2021(UTC) Posts: 11 Location: Mashhad Thanks: 5 times
|
Is there any solution to solve this problem?
|
|
|
|
Rank: Advanced Member
Groups: Registered
Joined: 12/27/2012(UTC) Posts: 5,243 Location: Belgium Thanks: 294 times Was thanked: 960 time(s) in 794 post(s)
|
Originally Posted by: Ham4u62 Is there any solution to solve this problem? Yes. It was given in the response. your testing for a change but the change is not possible as the variable to check is not updated within the loop so it wil never change the the outcome within the loop Correct the logic of the script
|
|
|
|
Rank: Member
Groups: Registered
Joined: 7/15/2021(UTC) Posts: 11 Location: Mashhad Thanks: 5 times
|
I don't want change anything. I want to read active input name and turn on an overlay base on my condition.If condition not met turn an overlays off and do this through loop always. can you give me a true logic based on my need
|
|
|
|
Rank: Advanced Member
Groups: Registered
Joined: 12/24/2021(UTC) Posts: 543 Location: athens Thanks: 130 times Was thanked: 74 time(s) in 70 post(s)
|
Originally Posted by: Ham4u62 I don't want change anything. I want to read active input name and turn on an overlay base on my condition.If condition not met turn an overlays off and do this through loop always. can you give me a true logic based on my need Hello. Try this one Code:
dim xml as string = ""
dim GetInputNumber as string = ""
dim GetInputName as string = ""
dim x as new system.xml.xmldocument
do while true
xml = API.XML() ' Fetch the current XML each time inside the loop
x.loadxml(xml)
GetInputNumber = x.SelectSingleNode("/vmix/active").InnerText
GetInputName = x.SelectSingleNode("//input[@number='"& GetInputNumber &"']/@title").Value
if GetInputName = "List - B" then
API.Function("OverlayInput1In", Input:="2")
else
API.Function("OverlayInput1Out")
end if
sleep(500) ' You can adjust this sleep if needed
loop
|
1 user thanked nikosman88 for this useful post.
|
|
|
Rank: Advanced Member
Groups: Registered
Joined: 12/27/2012(UTC) Posts: 5,243 Location: Belgium Thanks: 294 times Was thanked: 960 time(s) in 794 post(s)
|
Originally Posted by: Ham4u62 I don't want change anything. I want to read active input name and turn on an overlay base on my condition.If condition not met turn an overlays off and do this through loop always. can you give me a true logic based on my need Well you will have to , at least the logic of your script to get the desired intent ! Advice is to study how to programm , is only way to learn for future , instead of relying on a fixed answer especially a basic one like this (Google is a good friend) I repeat , the solution was given , now Nikosman88 gave you the written solution , hope you will see that the provious answer were correct regarding the logic Compare Yours and his and learn.
|
1 user thanked doggy for this useful post.
|
|
|
Rank: Member
Groups: Registered
Joined: 7/15/2021(UTC) Posts: 11 Location: Mashhad Thanks: 5 times
|
Thank you doggy for your piece of advice. I'm learning scripting and specially logic first and said I'm not good at scripting.I searched and didn't find proper solution and decided to ask here.
|
|
|
|
Rank: Advanced Member
Groups: Registered
Joined: 12/24/2021(UTC) Posts: 543 Location: athens Thanks: 130 times Was thanked: 74 time(s) in 70 post(s)
|
Originally Posted by: doggy Compare Yours and his and learn I like to be honest. My answer to an allready 99% made script from Ham4u62 is AI generated answer and i dont feel any shame for it. At 2024 we also have a great tool to do things and personally im using it when i think it can help.
|
1 user thanked nikosman88 for this useful post.
|
|
|
Rank: Member
Groups: Registered
Joined: 7/15/2021(UTC) Posts: 11 Location: Mashhad Thanks: 5 times
|
Originally Posted by: nikosman88 Originally Posted by: doggy Compare Yours and his and learn I like to be honest. My answer to an allready 99% made script from Ham4u62 is AI generated answer and i dont feel any shame for it. At 2024 we also have a great tool to do things and personally im using it when i think it can help. Two Thumbs Up It works Properly and fine
|
|
|
|
Rank: Advanced Member
Groups: Registered
Joined: 12/24/2021(UTC) Posts: 543 Location: athens Thanks: 130 times Was thanked: 74 time(s) in 70 post(s)
|
Originally Posted by: Ham4u62 Thank you doggy for your piece of advice. I'm learning scripting and specially logic first and said I'm not good at scripting.I searched and didn't find proper solution and decided to ask here. That`s the right way. First think how to do it and if you dont know,search. This is also how i work. For example if you didnt have the most script and go to chatgpt and ask from 0 to do it,it will fail.
|
|
|
|
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