Author Topic: Scripting with Process Icons  (Read 271 times)

sharkmelley

  • Newbie
  • Posts: 12
    • View Profile
Scripting with Process Icons
« on: 2012 March 23 06:06:34 »

I have a script that runs a few processes in succession - some are "global context" processes and some are not.   The output files from one process become the input files to the next etc.  I did this because I couldn't put all the processes in a ProcessContainer to run them on multiple files - the ProcessContainer complained when trying to run a global context process.

Unfortunately it means the script has to set up lots of parameter values for the various processes.  What I would like to do instead is to pick up existing process icons (whose parameters I have already carefully set) and use the script to tell those processes which files to work on.   There may already be a way of doing this but I haven't found it!

Mark

Juan Conejero

  • PTeam Member
  • PixInsight Jedi Grand Master
  • ********
  • Posts: 3895
    • View Profile
    • http://pixinsight.com/
Re: Scripting with Process Icons
« Reply #1 on: 2012 March 23 08:40:16 »
Hi Mark,

This is already implemented since version 1.7.4 as the following static methods of the ProcessInstance object:

Array ProcessInstance.icons()

Returns an array of strings with the identifiers of all currently defined process icons. Returns an empty array if there are no icons.

Array ProcessInstance.iconsByProcessId( String processId )

Returns an array of strings with the identifiers of all process icons transporting instances of the specified process. Returns an empty array if there are no icons, or if no icons transport instances of the specified process.

ProcessInstance ProcessInstance.fromIcon( String iconId )

Returns the instance transported by the specified icon, or null if no icon exists with the iconId identifier.

Example:

var id = "Process02";
var p = ProcessInstance.fromIcon( id );
if ( p == null )
   console.writeln( "No such icon: " + id );
if ( p instanceof PixelMath )
   console.writeln( "The icon \'", id, "\' transports a PixelMath instance" );

Juan Conejero
PixInsight Development Team
http://pixinsight.com/

sharkmelley

  • Newbie
  • Posts: 12
    • View Profile
Re: Scripting with Process Icons
« Reply #2 on: 2012 March 25 18:05:24 »
That's great!

Thanks!