Weka segmentation in macro

When using the Trainable Weka in a macro, I noticed you need a waiting time built in after the loading of the Classifier and the applying of it. is there another option than wait(n); here? like wait for a window to open, or wait for the plugin to finish a certain action?

Unfortunately no (to my knowledge).

You could do something like:

run("Trainable Weka Segmentation");

while(getInfo("window.title") != "Trainable Weka Segmentation v3.2.31") {

selectWindow("Trainable Weka Segmentation v3.2.31");

… but that risks running an endless loop when TWS changes its window title with the next release version.

I recommend using one of the more powerful scripting languages, such as Groovy or Beanshell, as illustrated here:

1 Like