How do Wildcards work?

Me again, sorry. I've got a set of dynamically-generated buttons named switch0, switch1, etc. If I use findChildOfWidget("switch"), nothing is returned. If I try to use a wildcard (i.e. findChildOfWidget("switch*")), nothing is returned. If I separate the wildcard from the string (findChildOfWidget("switch" + *)), I get an error. Do wildcards even work in QTScripts? If so, HOW?

Comments

  • I'm going to guess that findChildOfWidget() just doesn't support wildcards, unfortunately.

    You could just get an array of all the children and filter that using a regex on the name.  Unless you've got really huge numbers of children (in your script, not in real life) in which case, you know, performance...

    var aChildren = Dialog.getChildrenOfWidget();var rgx = /Switch*/;var aSwitches = aChildren.filter(	function(btn) {		if (rgx.test(btn.name)) {			return(btn)		}	})aSwitches.forEach(	function(b) {		print(b.name, b.className());	})

    You could filter by other properties of the children as well within the function of course, like class name for example.

Sign In or Register to comment.