vMix Forums
	 » 
	General
	 » 
	GT
	 » 
	Text Replace Script for Title
	 
	
        
            
            
    
        
	Rank: Member
  Groups: Registered
 Joined: 8/26/2020(UTC) Posts: 17   Location: Charlotte Thanks: 1 times
  
	 
	
     | 
    
        
            
		      
                So I have a title and script that I have running with race scoring data. The race data outputs a text of "+1 lap" when in reality it should just be blank. So because i cant change how the data is created I have a script running to replace the text "+1 lap" with "" (blank). This for the most part works, however the "+1 lap" text flashes periodically, so its not a clean replacement. Is there something I'm missing that could eliminate this flashing? I've included the script I'm running for the timing and a video example below. Thanks for any assistance. video example (position 5)Script: Quote:while (true)
  if Input.Find("Time Side Bar").Text("Time 2.Text")="+1 lap"
  Input.Find("Time Side Bar").Text("Time 2.Text")=""
  end if
  if Input.Find("Time Side Bar").Text("Time 3.Text")="+1 lap"
  Input.Find("Time Side Bar").Text("Time 3.Text")=""
  end if
  if Input.Find("Time Side Bar").Text("Time 4.Text")="+1 lap"
  Input.Find("Time Side Bar").Text("Time 4.Text")=""
  end if
  if Input.Find("Time Side Bar").Text("Time 5.Text")="+1 lap"
  Input.Find("Time Side Bar").Text("Time 5.Text")=""
  end if
  if Input.Find("Time Side Bar").Text("Time 6.Text")="+1 lap"
  Input.Find("Time Side Bar").Text("Time 6.Text")=""
  end if
  if Input.Find("Time Side Bar").Text("Time 7.Text")="+1 lap"
  Input.Find("Time Side Bar").Text("Time 7.Text")=""
  end if
  if Input.Find("Time Side Bar").Text("Time 8.Text")="+1 lap"
  Input.Find("Time Side Bar").Text("Time 8.Text")=""
  end if
  if Input.Find("Time Side Bar").Text("Time 9.Text")="+1 lap"
  Input.Find("Time Side Bar").Text("Time 9.Text")=""
  end if
  if Input.Find("Time Side Bar").Text("Time 10.Text")="+1 lap"
  Input.Find("Time Side Bar").Text("Time 10.Text")=""
 
  end if End While   
            
	  
         
     | 
    | 
         
             
     | 
    
         
            
         
     | 
    | 
        
	
     | 
        
        
        
            
        
            
            
    
        
	Rank: Advanced Member
  Groups: Registered
 Joined: 12/27/2012(UTC) Posts: 5,453  Location: Belgium Thanks: 311 times Was thanked: 1008 time(s) in 830 post(s)
  
	 
	
     | 
    
        
            
		      
                That's completely normal as you do your value checking after it has been loaaded/displayed already (textblock received the value first) 
  best option is to use duplicate hidden textboxes , check and proces their values and plce the result in the visible textboxes
  Also refine the code (less then 10 lines)  with a loop and nr variable = less code written as they are all the same test anyway , only thing that changes is the textbox number value  
            
	  
         
     | 
    | 
         
             
     | 
    
         
            
         
     | 
    | 
        
	
     | 
        
        
        
    
        
            
            
    
        
	Rank: Member
  Groups: Registered
 Joined: 8/26/2020(UTC) Posts: 17   Location: Charlotte Thanks: 1 times
  
	 
	
     | 
    
        
            
		      
                I see, I'll give the hidden boxes a run and see how it works for me.
  Not sure how to go about the loop and nr variable as I'm just figuring out scripts for these things. 
            
	  
         
     | 
    | 
         
             
     | 
    
         
            
         
     | 
    | 
        
	
     | 
        
        
        
            
        
            
            
    
        
	Rank: Advanced Member
  Groups: Registered
 Joined: 12/27/2012(UTC) Posts: 5,453  Location: Belgium Thanks: 311 times Was thanked: 1008 time(s) in 830 post(s)
  
	 
	
     | 
    
        
            
		      
                Originally Posted by: hpages  I see, I'll give the hidden boxes a run and see how it works for me.
  Not sure how to go about the loop and nr variable as I'm just figuring out scripts for these things.  something like this (partially tested) Code:dim HiddenTextBox As string = ""
do while true
   For X As Integer = 1 To 10
	HiddenTextBox = Input.Find("Time Side Bar").Text("TestBlock"  + X.tostring + ".Text")
	if HiddenText = "+1 lap"
		Input.Find("Time Side Bar").Text("Time "  + X.tostring + ".Text")= ""
	else
		Input.Find("Time Side Bar").Text("Time "  + X.tostring + ".Text")= HiddenTextBox
	end if
   next
loop 
  
            
	  
         
     | 
    | 
         
             
     | 
    
         
            
         
     | 
    | 
        
	
     | 
        
        
        
    
        
            
            
    
        
	Rank: Member
  Groups: Registered
 Joined: 8/26/2020(UTC) Posts: 17   Location: Charlotte Thanks: 1 times
  
	 
	
     | 
    
        
            
		      
                Originally Posted by: doggy  Originally Posted by: hpages  I see, I'll give the hidden boxes a run and see how it works for me.
  Not sure how to go about the loop and nr variable as I'm just figuring out scripts for these things.  something like this (partially tested) Code:dim HiddenTextBox As string = ""
do while true
   For X As Integer = 1 To 10
	HiddenTextBox = Input.Find("Time Side Bar").Text("TestBlock"  + X.tostring + ".Text")
	if HiddenText = "+1 lap"
		Input.Find("Time Side Bar").Text("Time "  + X.tostring + ".Text")= ""
	else
		Input.Find("Time Side Bar").Text("Time "  + X.tostring + ".Text")= HiddenTextBox
	end if
   next
loop 
  I've attempted the hidden text box method with both my script and the one you provided. The issue still occurs like it has been with my script even though I have it reading the hidden text boxes (ex: Hide Time 2.text) When I used the code you provided, it actually wiped all of the timing data off regardless of the +1 lap requirement. I used the code below Code:dim HiddenTextBox As string = ""
do while true
   For X As Integer = 2 To 10
	HiddenTextBox = Input.Find("Time Side Bar").Text("Hide Time"  + X.tostring + ".Text")
	if HiddenTextBox = "+1 lap"
		Input.Find("Time Side Bar").Text("Time "  + X.tostring + ".Text")= ""
	else
		Input.Find("Time Side Bar").Text("Time "  + X.tostring + ".Text")= HiddenTextBox
	end if
   next
loop 
  
            
	  
         
     | 
    | 
         
             
     | 
    
         
            
         
     | 
    | 
        
	
     | 
        
        
        
            
        
            
            
    
        
	Rank: Advanced Member
  Groups: Registered
 Joined: 12/27/2012(UTC) Posts: 5,453  Location: Belgium Thanks: 311 times Was thanked: 1008 time(s) in 830 post(s)
  
	 
	
     | 
    
        
            
		      
                Quote:I've attempted the hidden text box method with both my script and the one you provided. The issue still occurs like it has been with my script even though I have it reading the hidden text boxes (ex: Hide Time 2.text)
  When I used the code you provided, it actually wiped all of the timing data off regardless of the +1 lap requirement. I used the code below  Did you change the data connection too? your source connected to the "Hide Time" textblocks ? also i noticed you have a habit of using spaces in the names (bad habit) and following your habit you might have missed one after "Hide Time" in the code  
            
	  
         
     | 
    
        
              1 user thanked doggy for this useful post.  
     | 
    
        
     | 
    | 
        
	
     | 
        
        
        
    
        
            
            
    
        
	Rank: Member
  Groups: Registered
 Joined: 8/26/2020(UTC) Posts: 17   Location: Charlotte Thanks: 1 times
  
	 
	
     | 
    
        
            
		      
                Originally Posted by: doggy  Quote:I've attempted the hidden text box method with both my script and the one you provided. The issue still occurs like it has been with my script even though I have it reading the hidden text boxes (ex: Hide Time 2.text)
  When I used the code you provided, it actually wiped all of the timing data off regardless of the +1 lap requirement. I used the code below  Did you change the data connection too? your source connected to the "Hide Time" textblocks ? also i noticed you have a habit of using spaces in the names (bad habit) and following your habit you might have missed one after "Hide Time" in the code  Thank you for your script and guidance! I was able to figure out what I was doing wrong and managed to make some additions to your script to suit our needs as well! Everything works great now! I'm also making a note to not use spaces in my titling from now on. Script I ended up with: Code:
dim HiddenTextBox As string = ""
do while true
   For X As Integer = 2 To 10
   
	HiddenTextBox = Input.Find("Time Side Bar").Text("Hide_Time_"+X.tostring+".Text")
	if HiddenTextBox = "+1 lap" or HiddenTextBox = ""
		Input.Find("Time Side Bar").Text("Time "  + X.tostring + ".Text")= ""
            Input.Find("Time Side Bar").Text("Plus Sign "  + X.tostring + ".Text")= ""
            
     elseif HiddenTextBox = "+2 laps"
		Input.Find("Time Side Bar").Text("Time "  + X.tostring + ".Text")= "1 lap"
            Input.Find("Time Side Bar").Text("Plus Sign "  + X.tostring + ".Text")= "+"
      else
		Input.Find("Time Side Bar").Text("Time "  + X.tostring + ".Text")= HiddenTextBox
	      Input.Find("Time Side Bar").Text("Plus Sign "  + X.tostring + ".Text")= "+"
      end if
   next
loop
 
  
            
	  
         
     | 
    | 
         
             
     | 
    
         
            
         
     | 
    | 
        
	
     | 
        
        
        
            
        
            
            
    
        
	Rank: Member
  Groups: Registered
 Joined: 8/26/2020(UTC) Posts: 17   Location: Charlotte Thanks: 1 times
  
	 
	
     | 
    
        
            
		      
                Quote:something like this (partially tested) Code:dim HiddenTextBox As string = ""
do while true
   For X As Integer = 1 To 10
	HiddenTextBox = Input.Find("Time Side Bar").Text("TestBlock"  + X.tostring + ".Text")
	if HiddenText = "+1 lap"
		Input.Find("Time Side Bar").Text("Time "  + X.tostring + ".Text")= ""
	else
		Input.Find("Time Side Bar").Text("Time "  + X.tostring + ".Text")= HiddenTextBox
	end if
   next
loop 
  Follow up to this, Is there a way I can make the text boxes fill in three numbers after the decimal point? I know there's a way to format the text and I haven't stumbled across a solution yet. EX:  "0.6" would be displayed "0.600" and "2" would be displayed "2.000"  
            
	  
         
     | 
    | 
         
             
     | 
    
         
            
         
     | 
    | 
        
	
     | 
        
        
        
    
                           
	vMix Forums
	 » 
	General
	 » 
	GT
	 » 
	Text Replace Script for Title
	 
	
    
        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