Hi Sander,
You're nailing a key topic here. Yes, more interaction between scripts and modules is very necessary at this point. This is in the todo list and will be implemented soon. I have already been working on it, and the solution is closer than it seems (did I say that PI 1.6.1 has many internal new features that still have not been enabled at the user interface level?
).
Right now you can do something like this:
var p = new PixelMath;
p.launchInterface();
sleep( 5 );
But this is pretty useless because (1) there is no way to replace sleep() with some control code to wait for the interface until it 'finishes', mainly because the interface doesn't work modally, and (2) the instance (p in the example above) isn't modified by the interface being launched.
So what we need is that a script can run a process interface in
slave mode. Basically, the process interface will be launched (or relaunched) as a modal window. The best candidate JS method is:
Boolean Instance.launchInterfaceModal( uint32 flags )
where the meaning (or even the existence of)
flags is still undefined. Note that this requires changes at the managed interface level, as the current 'Execute = F5' and 'Execute Global = F6' automatically generated features doesn't make sense in slave mode. They will be replaced (in a completely automated way) by more standard 'OK' and 'Cancel' fatures on the interface's control bar. Note also that there will be changes at the PCL level, especially new member functions of the ProcessInterface class. There are also some problematic interactions with PI's workspace but nothing too difficult to solve.
As you may expect, Instance.launchInterfaceModal() returns true if the user selects 'OK' and false otherwise. When true is returned, the calling instance has already been replaced with the newly edited one.
Hopefully this will be reality in 1.6.2 or 1.6.3.