Converting a script to use Image Containers -- How?

aworonow

Well-known member
Hello, I found a comment by Juan a while back that it was now easy to convert a script so it could use process containers. But he did not say how it is done. I new at this script-writing business and do not see an obvious path to accomplishing this goal. Could someone point me to a description of how it is done, or suggest how to modify my script fragment below? Or is it not that easy and requires coding several more functions?

Thanks much, Alex

function main() {
Console.abortEnabled = true;

if (Parameters.isGlobalTarget) {
Console.writeln("Global execution");
this.StarsBeGone(ImageWindow.activeWindow.mainView);
Console.writeln ("DONE");
Console.hide();
return;
}

if (Parameters.isViewTarget) {
Console.writeln("View execution");
this.StarsBeGone(ImageWindow.activeWindow.mainView);
Console.writeln ("DONE");
Console.hide();
return;
}

// execute via user interface
let parametersDialog = new parametersDialogPrototype();
if( parametersDialog.execute() == 0 ) return;

// normal execution via a dialog
this.StarsBeGone(ImageWindow.activeWindow.mainView);

Console.writeln ("DONE");
Console.hide();
};

main();
 
Hello, I found a comment by Juan a while back that it was now easy to convert a script so it could use process containers. But he did not say how it is done. I new at this script-writing business and do not see an obvious path to accomplishing this goal. Could someone point me to a description of how it is done, or suggest how to modify my script fragment below? Or is it not that easy and requires coding several more functions?

Thanks much, Alex

function main() {
Console.abortEnabled = true;

if (Parameters.isGlobalTarget) {
Console.writeln("Global execution");
this.StarsBeGone(ImageWindow.activeWindow.mainView);
Console.writeln ("DONE");
Console.hide();
return;
}

if (Parameters.isViewTarget) {
Console.writeln("View execution");
this.StarsBeGone(ImageWindow.activeWindow.mainView);
Console.writeln ("DONE");
Console.hide();
return;
}

// execute via user interface
let parametersDialog = new parametersDialogPrototype();
if( parametersDialog.execute() == 0 ) return;

// normal execution via a dialog
this.StarsBeGone(ImageWindow.activeWindow.mainView);

Console.writeln ("DONE");
Console.hide();
};

main();
I would recommend watching:
 
Thanks, that tutorial is where I started--great intro!!! But it doesn't address interacting with ImageContainers. My script works fine but does not do that one thing extra, a considerable time saver, that I really want.
a
 
Thanks, that tutorial is where I started--great intro!!! But it doesn't address interacting with ImageContainers. My script works fine but does not do that one thing extra, a considerable time saver, that I really want.
a
In Parameters.isViewTarget mode, you need to access the the current target view (supplied by the ImageContainer). This can be accessed from the Parameters object:
myTargetView = Parameters.targetView;
 
Back
Top