Author Topic: Scripting options  (Read 5039 times)

Offline RobF2

  • PixInsight Addict
  • ***
  • Posts: 189
  • Rob
    • Rob's Astropics
Scripting options
« on: 2012 April 24 04:22:20 »
OK, pardon my ignorance, but does all scripting in PI have to be done in PJSR?  There is no simple high level "batch script" type syntax possible?  (or could I call the PI class library from VB.NET for example?).

I exploring options to automate common procedures (particularly pre-processing things that bug me).


Thanks for any clarification.
FSQ106/8" Newt on NEQ6/HEQ5Pro via EQMOD | QHY9 | Guiding:  ZS80II/QHY5IIL | Canon 450D | DBK21 and other "stuff"
Rob's Astropics

Offline Juan Conejero

  • PTeam Member
  • PixInsight Jedi Grand Master
  • ********
  • Posts: 7111
    • http://pixinsight.com/
Re: Scripting options
« Reply #1 on: 2012 April 24 04:43:20 »
Hi Rob,

Yes, you can write a shell script in PixInsight. You have an example in the startup.scp script (you'll find it on the bin installation folder), which PixInsight executes automatically upon startup. Basically, you can write everything you can execute from the command line as a script and run it as a batch process. You can even embed JavaScript fragments in a PI shell script.

However, there are some limitations in PI shell scripts. The main one is that, unfortunately, not all processes have a command-line interface available. This happens because we or the authors of those processes still haven't had the time to implement the required command-line support routines. In other cases, a command-line interface doesn't make sense, such as highly interactive tools.

These limitations will be overcome in the future, but right now you have to check if the processes that you want to run can be executed from the command line (other than to launch their interfaces, which is available for all processes).

Having said that, I personally recommend you write all your batch procedures as JavaScript scripts in PixInsight. The PJSR is much more powerful and flexible, and doesn't have any of the limitations that I have described.

Regarding .NET languages, they are incompatible (both technically and philosophically :) ) with PixInsight.

Let me know if you need more information on PI shell scripts.
Juan Conejero
PixInsight Development Team
http://pixinsight.com/

Offline RobF2

  • PixInsight Addict
  • ***
  • Posts: 189
  • Rob
    • Rob's Astropics
Re: Scripting options
« Reply #2 on: 2012 April 24 04:47:39 »
Many thanks for the fast reply Juan

I'd like to play with PJSR but think it's likely I won't have time to get into it too far.  Shell scripts sound like a logical place to start, so will have a closer look at that first as you suggest.  No more mention of .NET - promise   >:D
FSQ106/8" Newt on NEQ6/HEQ5Pro via EQMOD | QHY9 | Guiding:  ZS80II/QHY5IIL | Canon 450D | DBK21 and other "stuff"
Rob's Astropics

Offline troypiggo

  • PixInsight Addict
  • ***
  • Posts: 258
Re: Scripting options
« Reply #3 on: 2012 April 24 21:52:06 »
Thanks for asking this, Rob, and thanks for the reply, Juan.  Must admit I've been wondering how I can have PI open things that you pretty much use every time, eg STF, on startup.  Adding it to startup.scp might be the way.  Thanks.

Offline Josh Lake

  • PixInsight Old Hand
  • ****
  • Posts: 424
Re: Scripting options
« Reply #4 on: 2012 April 25 05:47:08 »
Troy, if you find a solution for this (STF especially), I'd love to know. I've done it with a process icon set, but I'd especially like STF to just be open from the beginning.

Offline troypiggo

  • PixInsight Addict
  • ***
  • Posts: 258
Re: Scripting options
« Reply #5 on: 2012 April 25 13:35:34 »
I did.  Just add the line:

Code: [Select]
ScreenTransferFunction --interface
to the end of the file Juan mentioned above, startup.scp.

You can also use the default alias:

Code: [Select]
stf --interface

Offline Josh Lake

  • PixInsight Old Hand
  • ****
  • Posts: 424
Re: Scripting options
« Reply #6 on: 2012 April 25 13:54:57 »
Ah, very easy, thanks!