vMix Forums
	 » 
	General
	 » 
	General Discussion
	 » 
	Skip preset when certain value is detected
	 
	
        
            
            
    | 
	Rank: Member
 Groups: Registered
 Joined: 11/5/2021(UTC) Posts: 16 Thanks: 2 times
 | 
            
		      
                Hi, I have a Title input with about 100 presets. I want to create a shortcut, that moves each time to the next preset.  That works fine.  However, I want to detect that, if a preset contains "(N)", that preset shouldn't be selected, but instead, it should jump to the next preset (I'll use that to, in that case, move to the next slide on another input). That detection seems to fail. Instead of moving to the next preset, it does display the "(N)", and on the next time I press the shortcut, it skips the next preset.  I've been programming for a very long time (clearly not in vmix :-)), but this one puzzles me.   So in this code, I basically move to the next preset (based on the content on DynamicValue1.  If it's (N), then I skip one further. Code:Dim VmixXML as new system.xml.xmldocument
Dim Dynamic1Val as Integer= 1
VmixXML.loadxml(API.XML)
dim title_text as string
Dim title_input_no as integer = 2
dim Dynamic1Node As XmlNode = VmixXML.selectSingleNode("/vmix/dynamic/value1")
Dynamic1Val = Dynamic1Node.InnerText
Dynamic1Val+=1 
API.Function("SetDynamicValue1", Value:=Dynamic1Val)
API.Function("SelectTitlePreset",Input:="Subtitles",Value:=Dynamic1Val)
title_text=""
title_text = (VmixXML.SelectSingleNode("//inputs//input[" & title_input_no & "]//text[1]").InnerText)
if title_text="(N)" then
    Dynamic1Val+=1 
    API.Function("SetDynamicValue1", Value:=Dynamic1Val)
    API.Function("SelectTitlePreset",Input:="Subtitles",Value:=Dynamic1Val)
end if
 I'm overlooking something... :-).  Any ideas ? | 
    | 
             | 
            
         | 
    |  | 
        
        
        
            
        
            
            
    | 
	Rank: Advanced Member
 Groups: Registered
 Joined: 12/27/2012(UTC) Posts: 5,449  Location: BelgiumThanks: 311 timesWas thanked: 1006 time(s) in 830 post(s)
 
 | 
            
		      
                Might be easier/more efficient to work with datasources instead of presets especially with that many data rows :-)
 before being abe to evaluate the data has to go to the title first ( selected )
 an easier way to check on content of a data field ( textblock) is using the scripting function  = Input.Find("Titlename").Text("TextBlockName.Text") as such no neeed to read the API XML
 When using a data source instead just select the next row . No need for using Dynamic values
 
 Personally i prefer to have textfields that have to be avaluated in a hidden textblock
 | 
    | 
              1 user thanked doggy for this useful post. |  | 
    |  | 
        
        
        
    
        
            
            
    | 
	Rank: Member
 Groups: Registered
 Joined: 11/5/2021(UTC) Posts: 16 Thanks: 2 times
 | 
            
		      
                Originally Posted by: doggy  Might be easier/more efficient to work with datasources instead of presets especially with that many data rows :-)
 before being abe to evaluate the data has to go to the title first ( selected )
 an easier way to check on content of a data field ( textblock) is using the scripting function  = Input.Find("Titlename").Text("TextBlockName.Text") as such no neeed to read the API XML
 When using a data source instead just select the next row . No need for using Dynamic values
 
 Personally i prefer to have textfields that have to be avaluated in a hidden textblock
 using input.find magically solved my issue, thanks a lot, it was driving my crazy ! Now that it works, I will try it to switch to a datasource, as you suggested, I've indeed noticed that using a large list of presets considerably slows things down. Thanks a lot !! Filip | 
    | 
             | 
            
         | 
    |  | 
        
        
        
            
        
            
            
    | 
	Rank: Member
 Groups: Registered
 Joined: 11/5/2021(UTC) Posts: 16 Thanks: 2 times
 | 
            
		      
                Originally Posted by: fideba  Originally Posted by: doggy  Might be easier/more efficient to work with datasources instead of presets especially with that many data rows :-)
 before being abe to evaluate the data has to go to the title first ( selected )
 an easier way to check on content of a data field ( textblock) is using the scripting function  = Input.Find("Titlename").Text("TextBlockName.Text") as such no neeed to read the API XML
 When using a data source instead just select the next row . No need for using Dynamic values
 
 Personally i prefer to have textfields that have to be avaluated in a hidden textblock
 using input.find magically solved my issue, thanks a lot, it was driving my crazy ! Now that it works, I will try it to switch to a datasource, as you suggested, I've indeed noticed that using a large list of presets considerably slows things down. Thanks a lot !! Filip And suddenly, life became much more simpler :-) Code:API.Function("DataSourceNextRow",Value:="Speech1,Sheet1")
dim title_text as string
title_text=Input.Find("TitleTest").Text("Headline.Text")
if title_text="(N)" then
    API.Function("DataSourceNextRow",Value:="Speech1,Sheet1")
    API.Function("NextItem",Input:="Slides1")
end if
 Thanks again for your help ! | 
    | 
             | 
            
         | 
    |  | 
        
        
        
    
        
            
            
    | 
	Rank: Advanced Member
 Groups: Registered
 Joined: 12/27/2012(UTC) Posts: 5,449  Location: BelgiumThanks: 311 timesWas thanked: 1006 time(s) in 830 post(s)
 
 | 
            
		      
                Sorry couldn't resist ;-) Code:API.Function("DataSourceNextRow",Value:="Speech1,Sheet1")
if Input.Find("TitleTest").Text("Headline.Text") ="(N)" then
    API.Function("DataSourceNextRow",Value:="Speech1,Sheet1")
    API.Function("NextItem",Input:="Slides1")
end if
 | 
    | 
             | 
            
         | 
    |  | 
        
        
        
            
        
            
            
    | 
	Rank: Member
 Groups: Registered
 Joined: 11/5/2021(UTC) Posts: 16 Thanks: 2 times
 | 
            
		      
                Originally Posted by: doggy  Sorry couldn't resist ;-) Code:API.Function("DataSourceNextRow",Value:="Speech1,Sheet1")
if Input.Find("TitleTest").Text("Headline.Text") ="(N)" then
    API.Function("DataSourceNextRow",Value:="Speech1,Sheet1")
    API.Function("NextItem",Input:="Slides1")
end if
 loool, we saved another few bytes ;-) | 
    | 
             | 
            
         | 
    |  | 
        
        
        
    
                           
	vMix Forums
	 » 
	General
	 » 
	General Discussion
	 » 
	Skip preset when certain value is detected
	 
	
    
        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