A quick and really simple one for someone I'm sure - but now me, sadly - is there a wildcard character I can use in conjunction with the selectwindow command which would allow me to match an unspecified character sequence as part of a name?
The IJ documentation I can unearth suggests that the * wildcard character only works with the close command. Not sure why, but it seems to be true.
Thanks very much for any help
Alex
is there a wildcard character I can use in conjunction with the selectwindow command which would allow me to match an unspecified character sequence as part of a name?
Not in the macro language. But this sort of operation is easy using one of the supported scripting languages of ImageJ2.
Here is an example Groovy script that activates the first window title matching the given regex:
// @String regex(label = "Regex string for window title")
import ij.IJ
import ij.WindowManager
titles = WindowManager.getImageTitles()
for (title in titles) {
if (title.matches(".*" + regex + ".*")) {
IJ.selectWindow(title)
break
}
}
IJ.showMessage("No matching window")