An Introduction To PixInsight Scripting: the recording of the webinar

Hi all,

I am surprised that up to now there is no reaction to the publication of the video of the webinar "An Introduction to PixInsight Scripting with PJSR" by Roberto Sartori (except the one from John Murphy, ). For me this video is an invaluable source of information. So I want to give a short review of the contents of the webinar here.

Special attention was paid to the concept of execution context (direct, global and target view context). It was made clear that a programmer has to give thought to how these different cases are handled in his script. This is important in order to be able to execute the script directly, to create an instance of the script and to execute the script on a target view.

An exemplary script (LchSaturation) was developed in the webinar step by step. Using the example of the CurvesTransformation, it was demonstrated how to use PixInsight's processes (i.e. execute external scriptable objects) in a script.

The Object Explorer, a valuable source of information for programming scripts, was extensively used to become acquainted with the available objects and their definition.

The graphical user interface was elucidated. For the script project covered in the webinar, structure tree and layout tree were shown and the realization of the GUI with the available objects in PixInsight was demonstrated. The usage of Event Handlers which play an important part in the realization of a user interface was explained.

Sometimes typos led to an error message, but this was helpful as well: it was shown how to interpret the message and correct the error. Tracking the execution of a script was realized by temporarily incorporating output of variables to the console. The audience was allowed to put interposed questions.

Throughout the development of the code, important concepts that are specific to the Javascript language were covered, e.g. inheritance, prototypes, the "this" keyword, defining functions as Arrow function expression, etc. I didn't understand all of these Javascript-specific concepts before because I am not sufficiently familiar with this language, but now I am able to specifically look up the details and I get an understanding under which conditions it is necessary to apply them. For me, the webinar is also a reason to again take an effort to learn the Javascript language in detail.

For the case of missing object definitions, the #include directive was covered which allows to import Javascript header files (JSH files) that contain PJSR definitions.

It was shown how to install a script in the PixInsight menu. Guidelines for programming scripts were given. Resources for programming scripts were compiled.

The webinar for the very first time gave me a coherent introduction to programming scripts in PixInsight. That is far more than what I (not being a programmer) could ever get from reading open source scripts. By studying script sources I mostly didn't understand why the code was programmed in that specific way, and often I didn't understand at all how it worked. I guess this has changed fundamentally after having listened to Roberto's lecture, because I now have a better understanding of the connections.

I want to say a big thank-you to Roberto Sartori for this valuable contribution that hopefully will encourage more PixInsight users to try programming a script. I would be pleased as well if it effected more frequent discussions in the forum category "PCL and PJSR Development".

Thank you for you feedbak Bernd.

We have received several e-mails of appreciation of the webinar held by Roberto.
Hello Edoardo, thank you for sharing this webinar.
Roberto it was a pleasure to watch this video which contain an invaluable source of information.
I am working through the video and got to the point (at 1:02:10) where we're adding the code for the VerticalSizer. However, when I run the script in direct context (via the Compile and Run button) I get an error message in the Process Console saying "line 18: ReferenceError: VerticalSizer is not defined". Can anyone see where I've gone wrong in my script please?
I can't see anything amiss in your code. It could be that something has got tangled elsewhere. Have you tried saving your work, exiting PixInsight altogether, then restarting PI, opening and running your code?
I can't see anything amiss in your code. It could be that something has got tangled elsewhere. Have you tried saving your work, exiting PixInsight altogether, then restarting PI, opening and running your code?
Thanks Mike. I've sussed out what was wrong - I needed to add the following line at the top of the script:

#include <pjsr/Sizer.jsh>

When you open the video in Youtube, there are links to the code in the comments - only just seen this. Here's a link to the specific script I was recreating:
Thanks for the video. It was great.
I downloaded an intermediate version of the script as I was having trouble creating my own while following along the video. It came up with an error while executing and I thought it was a lack of header files. So in the attached, I added all the header files for scripts possible in the current Pixinsight version. In case it's of use to anyone, you can copy and paste the include section in your own scripts. I downloaded one of the complete versions of the script and it worked perfectly. Thanks.


  • 06.
    2.5 KB · Views: 107