vMix Forums
»
General
»
GT
»
Hiding image based on null value
Rank: Advanced Member
Groups: Registered
Joined: 12/3/2013(UTC) Posts: 121 Location: Arizona
Thanks: 8 times Was thanked: 6 time(s) in 6 post(s)
|
I have the following script, but it is not performing as expected. I'd like to hide the green images if that column is null. Dim title = Input.Find("CUT TEST.gtzip") Dim transferredFields = New String() {"Transferred10", "Transferred8", "Transferred8"} Dim imageFields = New String() {"Image10.Source", "Image9.Source", "Image8.Source"} For i As Integer = 0 To transferredFields.Length - 1 Dim value = title.Text(transferredFields(i)).Trim().ToLower() If value = "q" Then title.Text(imageFields(i)) = "Image10.Source" ' <-- Replace with actual image name if different Console.WriteLine(transferredFields(i) & " = Q → Showing " & imageFields(i)) Else title.Text(imageFields(i)) = "" Console.WriteLine(transferredFields(i) & " ≠ Q → Hiding " & imageFields(i)) End If Next  Screenshot 2025-04-16 132730.png (103kb) downloaded 4 time(s).Any advice?
|
|
|
|
Rank: Advanced Member
Groups: Registered
Joined: 12/24/2021(UTC) Posts: 641  Location: athens Thanks: 155 times Was thanked: 84 time(s) in 80 post(s)
|
Hi. This script to my little knowledge it seems to me in-complete. Correct me if i am wrong but i dont see in your code a command like "api function"-->do this when the "if" situation is meet I see in vmix api that exist https://vmixapi.com/?function=SetImageVisibleOn and https://vmixapi.com/?function=SetImageVisibleOff in order to set the image visibility on or off. In your script i dont see something like this,that will tell vmix how to hide/unhide the image when the condition fits Edit. Based in the scripting of dummies thread and https://tvcrew.ch/wiki/d...hp?id=scripting_examples a working script that do what you need will be like this Code:
dim a as string
do while true
a= Input.Find("scoreboard").Text("Title Text.Text")
if a = "" then
API.Function("SetImageVisibleOFF",Input:="scoreboard",SelectedName:="Image2.Source")
else
API.Function("SetImageVisibleON",Input:="scoreboard",SelectedName:="Image2.Source")
end if
sleep(500)
loop
replace with your input title names and try if works
|
|
|
|
Rank: Advanced Member
Groups: Registered
Joined: 12/3/2013(UTC) Posts: 121 Location: Arizona
Thanks: 8 times Was thanked: 6 time(s) in 6 post(s)
|
This should suffice?
Dim title = Input.Find("cut_test.gtzip") Dim Transferred(10) As String
Do While True For i As Integer = 1 To 10 Transferred(i) = title.Text("Transferred" & i).Trim().ToLower()
If Transferred(i) = "Q" Then API.Function("SetImageVisibleON", Input:="cut_test.gtzip", SelectedName:="Image" & i & ".Source") Console.WriteLine("Transferred" & i & " = q → Showing image " & i) Else API.Function("SetImageVisibleOFF", Input:="cut_test.gtzip", SelectedName:="Image" & i & ".Source") Console.WriteLine("Transferred" & i & " ≠ q → Hiding image " & i) End If Next
Sleep(500) Loop
|
|
|
|
Rank: Advanced Member
Groups: Registered
Joined: 12/24/2021(UTC) Posts: 641  Location: athens Thanks: 155 times Was thanked: 84 time(s) in 80 post(s)
|
I dont know if suffice or not,because i dont have a sample image to check. Anyway this time i described to AI what to do and it come up with the following. In my example i assume that TitleText1.Text layer is "pair" with Image1.Source and so on until to 10. Code:
Dim a As String
Dim i As Integer
Do While True
For i = 1 To 10
' Διαβάζουμε το αντίστοιχο TitleText{i}.Text
a = Input.Find("scoreboard").Text("TitleText" & i & ".Text")
' Αν το κείμενο είναι κενό ή μόνο whitespace, κλείνουμε το Image.
If String.IsNullOrWhiteSpace(a) Then
API.Function("SetImageVisibleOFF", Input:="scoreboard", SelectedName:="Image" & i & ".Source")
Else
API.Function("SetImageVisibleON", Input:="scoreboard", SelectedName:="Image" & i & ".Source")
End If
Next
Sleep(500)
Loop
i cannot say if it works or not but if yours not work,try it.
|
|
|
|
Rank: Advanced Member
Groups: Registered
Joined: 5/14/2013(UTC) Posts: 143  Location: uk Thanks: 2 times Was thanked: 24 time(s) in 20 post(s)
|
How did you build your GT title ?? Did you import a psd with layers if so you can’t turn images off/on , they must have been imported into the GT title as separate images
|
|
|
|
Rank: Advanced Member
Groups: Registered
Joined: 12/3/2013(UTC) Posts: 121 Location: Arizona
Thanks: 8 times Was thanked: 6 time(s) in 6 post(s)
|
It is an imported .psd, but the squares in question were recreated in GT.
I threw in the towel and ended up modifying the incoming JSON to include columns with hyperlinks to the images to display depending on the status of the column with the Q's in it. If a Q is present, the green box image is linked for display. If not, a transparent image displays. It works perfectly.
|
|
|
|
vMix Forums
»
General
»
GT
»
Hiding image based on null 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