logo

Live Production Software Forums


Welcome Guest! To enable all features please Login or Register.

Notification

Icon
Error

Options
Go to last post Go to first unread
calamityjane  
#1 Posted : Wednesday, July 10, 2019 10:42:57 PM(UTC)
calamityjane

Rank: Advanced Member

Groups: Registered
Joined: 9/26/2014(UTC)
Posts: 104
Man
Location: Canada

Thanks: 39 times
Was thanked: 5 time(s) in 5 post(s)
I have a GT Designer graphic Title with a couple of elements "hidden" to start out. At some point I want to unveil them. I am struggling trying to ascertain the correct syntax of the API script.

I am thinking it should be:

http://127.0.0.1:8088/API/?Function=SetImageVisible&Value=1ytvscorebug1.gtzip&Image=HomeP2.Source


where the scorebug is the GT graphic and HomeP2.Source is the element I wish to unveil

Currently vMix displays whichever element is first in the list of hidden elements in the Title.

Looking for the correct syntax of this shortcut
doggy  
#2 Posted : Wednesday, July 10, 2019 11:01:03 PM(UTC)
doggy

Rank: Advanced Member

Groups: Registered
Joined: 12/27/2012(UTC)
Posts: 5,057
Belgium
Location: Belgium

Thanks: 283 times
Was thanked: 916 time(s) in 755 post(s)
where did you get the SetImageVisible from ?
Peter1000  
#3 Posted : Thursday, July 11, 2019 3:31:29 AM(UTC)
Peter1000

Rank: Advanced Member

Groups: Registered
Joined: 1/25/2019(UTC)
Posts: 284
Switzerland

Thanks: 16 times
Was thanked: 73 time(s) in 54 post(s)
I use a small, full transparent picture as source and load the „visible“ on demand.
doggy  
#4 Posted : Thursday, July 11, 2019 5:56:11 AM(UTC)
doggy

Rank: Advanced Member

Groups: Registered
Joined: 12/27/2012(UTC)
Posts: 5,057
Belgium
Location: Belgium

Thanks: 283 times
Was thanked: 916 time(s) in 755 post(s)
i meant as API function
calamityjane  
#5 Posted : Thursday, July 11, 2019 6:08:12 AM(UTC)
calamityjane

Rank: Advanced Member

Groups: Registered
Joined: 9/26/2014(UTC)
Posts: 104
Man
Location: Canada

Thanks: 39 times
Was thanked: 5 time(s) in 5 post(s)
Originally Posted by: doggy Go to Quoted Post
where did you get the SetImageVisible from ?



SetImageVisible is a function listed in the shortcuts for Titles. When designing the Title graphic I make this element "Show Visble Toggle" in the data tab. You can then use this shortcut to make it visible.

My issue I can't make it work ( I don't know the syntax) for the API script. It works in Web Controller but I cant find the right combination in the API script.

Whit
doggy  
#6 Posted : Thursday, July 11, 2019 7:29:23 AM(UTC)
doggy

Rank: Advanced Member

Groups: Registered
Joined: 12/27/2012(UTC)
Posts: 5,057
Belgium
Location: Belgium

Thanks: 283 times
Was thanked: 916 time(s) in 755 post(s)
My apologies, i was still on .54 (not .60)

http://127.0.0.1:8088/API/?Function=SetImageVisible&Input=demo.gtzip&Image=Image1.Source , for the Image one can use also SelectedIndex=#
thanks 1 user thanked doggy for this useful post.
calamityjane on 7/11/2019(UTC)
calamityjane  
#7 Posted : Thursday, July 11, 2019 8:31:12 AM(UTC)
calamityjane

Rank: Advanced Member

Groups: Registered
Joined: 9/26/2014(UTC)
Posts: 104
Man
Location: Canada

Thanks: 39 times
Was thanked: 5 time(s) in 5 post(s)
Originally Posted by: doggy Go to Quoted Post
My apologies, i was still on .54 (not .60)

http://127.0.0.1:8088/API/?Function=SetImageVisible&Input=demo.gtzip&Image=Image1.Source , for the Image one can use also SelectedIndex=#


Hi

Hurrah, your suggestion re SelectedIndex worked.

Thank thank you

Whit
doggy  
#8 Posted : Thursday, July 11, 2019 3:45:32 PM(UTC)
doggy

Rank: Advanced Member

Groups: Registered
Joined: 12/27/2012(UTC)
Posts: 5,057
Belgium
Location: Belgium

Thanks: 283 times
Was thanked: 916 time(s) in 755 post(s)
To be honest it was all there not? :-)

shortcut.JPG (34kb) downloaded 2 time(s).


be it Image or SelectedValue don't seem to be able to accept which when multiple images are in the title i case of an API request
Janne Adolfsson  
#9 Posted : Wednesday, September 11, 2019 12:34:29 AM(UTC)
Janne Adolfsson

Rank: Member

Groups: Registered
Joined: 2/19/2015(UTC)
Posts: 14
Location: Östersund, Sweden

Thanks: 2 times
Am I just stupid?


I'm trying to use the function in a script like this

If Input.Find("ScoreBoardTop.gtxml").text("PeneltyH2.Text") = "" Then
API.Function("SetImageVisibleOff","ScoreBoardTop.gtxml","HP2.Source")
Else
API.Function("SetImageVisibleOn","ScoreBoardTop.gtxml","HP2.Source")
End If

I just want the image to be visible if there is a value in PeneltyH2.Text.

Whatever i do it just selects the first image i the title.

Any suggestions?
ryanlehms  
#10 Posted : Friday, July 9, 2021 11:59:21 AM(UTC)
ryanlehms

Rank: Newbie

Groups: Registered
Joined: 3/4/2019(UTC)
Posts: 9
United States
Location: Iowa

Thanks: 5 times
Was thanked: 3 time(s) in 2 post(s)
For anybody else that stumbles across this thread as I did...


Here is a reliable way to toggle visibility on and off:

If (String.Equals(atBat, homeTeam)) Then
API.Function("SetImageVisibleOff",Input:="Scorebug",SelectedName:="Top-Inning.Source")
API.Function("SetImageVisibleOn",Input:="Scorebug",SelectedName:="Bottom-Inning.Source")
Console.WriteLine("Home Team at bat")
else
API.Function("SetImageVisibleOff",Input:="Scorebug",SelectedName:="Bottom-Inning.Source")
API.Function("SetImageVisibleOn",Input:="Scorebug",SelectedName:="Top-Inning.Source")
Console.WriteLine("Away Team at bat")
End If



And here is an incorrect way that intermittently works:


If (String.Equals(atBat, homeTeam)) Then
API.Function("SetImageVisibleOff","Scorebug","Top-Inning.Source")
API.Function("SetImageVisibleOn","Scorebug","Bottom-Inning.Source")
Console.WriteLine("Home Team at bat")
else
API.Function("SetImageVisibleOff","Scorebug","Bottom-Inning.Source")
API.Function("SetImageVisibleOn","Scorebug","Top-Inning.Source")
Console.WriteLine("Away Team at bat")
End If
dtraut  
#11 Posted : Friday, October 22, 2021 3:55:08 AM(UTC)
dtraut

Rank: Newbie

Groups: Registered
Joined: 8/9/2020(UTC)
Posts: 5
United States
Location: Wisconsin

Was thanked: 1 time(s) in 1 post(s)
Question and was trying to do the same type of thing...

I have a text field with a number in it and depending on that number (1-8) I want 8 buttons to either be on/off using SetImageVisible.

I have this script but it doesn't seem to do anything and wondering if someone can help. Basically if it finds the text field with 6, then buttons 1-6 are on and 7-8 are off. Scorebug is the template. RedRocks.text is the text field with the number and button1.Source is the image. I would continue this for "1" through "8" with each having the End If. I only put the first 3 sections on here but you get the idea.

If Input.Find("scorebug.gtzip").Text("RedRocks.Text") = "8" Then
API.Function("SetImageVisibleOn", "scorebug.gtzip","button1.Source")
API.Function("SetImageVisibleOn", "scorebug.gtzip","button2.Source")
API.Function("SetImageVisibleOn", "scorebug.gtzip","button3.Source")
API.Function("SetImageVisibleOn", "scorebug.gtzip","button4.Source")
API.Function("SetImageVisibleOn", "scorebug.gtzip","button5.Source")
API.Function("SetImageVisibleOn", "scorebug.gtzip","button6.Source")
API.Function("SetImageVisibleOn", "scorebug.gtzip","button7.Source")
API.Function("SetImageVisibleOn", "scorebug.gtzip","button8.Source")
End If

If Input.Find("scorebug.gtzip").Text("RedRocks.Text") = "7" Then
API.Function("SetImageVisibleOn", "scorebug.gtzip","button1.Source")
API.Function("SetImageVisibleOn", "scorebug.gtzip","button2.Source")
API.Function("SetImageVisibleOn", "scorebug.gtzip","button3.Source")
API.Function("SetImageVisibleOn", "scorebug.gtzip","button4.Source")
API.Function("SetImageVisibleOn", "scorebug.gtzip","button5.Source")
API.Function("SetImageVisibleOn", "scorebug.gtzip","button6.Source")
API.Function("SetImageVisibleOn", "scorebug.gtzip","button7.Source")
API.Function("SetImageVisibleOff", "scorebug.gtzip","button8.Source")
End If

If Input.Find("scorebug.gtzip").Text("RedRocks.Text") = "6" Then
API.Function("SetImageVisibleOn", "scorebug.gtzip","button1.Source")
API.Function("SetImageVisibleOn", "scorebug.gtzip","button2.Source")
API.Function("SetImageVisibleOn", "scorebug.gtzip","button3.Source")
API.Function("SetImageVisibleOn", "scorebug.gtzip","button4.Source")
API.Function("SetImageVisibleOn", "scorebug.gtzip","button5.Source")
API.Function("SetImageVisibleOn", "scorebug.gtzip","button6.Source")
API.Function("SetImageVisibleOff", "scorebug.gtzip","button7.Source")
API.Function("SetImageVisibleOff", "scorebug.gtzip","button8.Source")
End If
doggy  
#12 Posted : Friday, October 22, 2021 4:22:26 AM(UTC)
doggy

Rank: Advanced Member

Groups: Registered
Joined: 12/27/2012(UTC)
Posts: 5,057
Belgium
Location: Belgium

Thanks: 283 times
Was thanked: 916 time(s) in 755 post(s)
Originally Posted by: dtraut Go to Quoted Post
Question and was trying to do the same type of thing...

I have a text field with a number in it and depending on that number (1-8) I want 8 buttons to either be on/off using SetImageVisible.

I have this script but it doesn't seem to do anything and wondering if someone can help. Basically if it finds the text field with 6, then buttons 1-6 are on and 7-8 are off. Scorebug is the template. RedRocks.text is the text field with the number and button1.Source is the image. I would continue this for "1" through "8" with each having the End If. I only put the first 3 sections on here but you get the idea.

If Input.Find("scorebug.gtzip").Text("RedRocks.Text") = "8" Then
API.Function("SetImageVisibleOn", "scorebug.gtzip","button1.Source")
API.Function("SetImageVisibleOn", "scorebug.gtzip","button2.Source")
API.Function("SetImageVisibleOn", "scorebug.gtzip","button3.Source")
API.Function("SetImageVisibleOn", "scorebug.gtzip","button4.Source")
API.Function("SetImageVisibleOn", "scorebug.gtzip","button5.Source")
API.Function("SetImageVisibleOn", "scorebug.gtzip","button6.Source")
API.Function("SetImageVisibleOn", "scorebug.gtzip","button7.Source")
API.Function("SetImageVisibleOn", "scorebug.gtzip","button8.Source")
End If

If Input.Find("scorebug.gtzip").Text("RedRocks.Text") = "7" Then
API.Function("SetImageVisibleOn", "scorebug.gtzip","button1.Source")
API.Function("SetImageVisibleOn", "scorebug.gtzip","button2.Source")
...............


Maybe have a browse through the "Scripting for dummies" post
It cant work if the functiosn are not correctly written

API.Function("SetImageVisibleOn",Input:="scorebug.gtzip",SelectedName:="button1.Source")

Also streamline your code with a smal for x to count found loops (less code)




dtraut  
#13 Posted : Friday, October 22, 2021 11:20:22 PM(UTC)
dtraut

Rank: Newbie

Groups: Registered
Joined: 8/9/2020(UTC)
Posts: 5
United States
Location: Wisconsin

Was thanked: 1 time(s) in 1 post(s)
Duh, sorry copied wrong script. Yes, you're right with the Input and Selected name. Pretty new to the scripting and trying to make it all work.

Do I have the IF/Then line right? I want to pull a value from a text box and whatever that value is, then apply the correct amount of visible buttons. Actually, could I pull that value right from the API?

I've been through the scripting for dummies section and maybe I'm just missing it?
doggy  
#14 Posted : Saturday, October 23, 2021 3:17:00 AM(UTC)
doggy

Rank: Advanced Member

Groups: Registered
Joined: 12/27/2012(UTC)
Posts: 5,057
Belgium
Location: Belgium

Thanks: 283 times
Was thanked: 916 time(s) in 755 post(s)
Originally Posted by: dtraut Go to Quoted Post
Do I have the IF/Then line right? I want to pull a value from a text box and whatever that value is, then apply the correct amount of visible buttons. Actually, could I pull that value right from the API?





kiss

Code:
dim x as integer
dim count as string = Input.Find("scorebug.gtzip").Text("RedRocks.Text")

For x = 1 to Convert.toInt32(count)
  API.Function("SetImageVisibleOn",Input:="scorebug.gtzip",SelectedName:="button" & x &".Source")
next


dtraut  
#15 Posted : Sunday, October 24, 2021 6:24:02 AM(UTC)
dtraut

Rank: Newbie

Groups: Registered
Joined: 8/9/2020(UTC)
Posts: 5
United States
Location: Wisconsin

Was thanked: 1 time(s) in 1 post(s)
Wow, I have a lot to learn. Thank you so much for your help. I was making that way more difficult.

Really appreciate the help with this.
Users browsing this topic
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.