Author Topic: Writing my first JavaScript- Help  (Read 6672 times)

Offline SanDiegoAstro

  • Newcomer
  • Posts: 15
Writing my first JavaScript- Help
« on: 2013 July 30 06:35:54 »
Hi!

I would like to start writing some basic scripts for automating some of my image processing work.   My image processing work at this time only involves the use of the process modules/scripts already part of PixInsight.

I am struggling to find any script examples written in JavaScript on this to get me started.   I even tried to open some of the existing batch scripts in PixInsight but I cannot seem to be able to access the source for them.

I am, of course, able to see the JavaScript source generated for each process that I run, so that is very helpful.  So it seems that I need to copy each of those process code snippets into a larger JavaScript file.   I would also like to add some dialog boxes to allow for various parameter inputs.   So nothing too complex.

If anyone could point me to a sample .js file that does something like this, it would be very helpful.

Thanks!


Offline Andres.Pozo

  • PTeam Member
  • PixInsight Padawan
  • ****
  • Posts: 927
Re: Writing my first JavaScript- Help
« Reply #1 on: 2013 July 30 06:44:06 »
The source code of the scripts is at "C:\Program Files\PixInsight\src\scripts" in Windows.

Offline SanDiegoAstro

  • Newcomer
  • Posts: 15
Re: Writing my first JavaScript- Help
« Reply #2 on: 2013 July 30 06:55:01 »
Hi, thanks.

I am running on a Mac.   When I search for .js files, I don't find any related to PixInsight.  Also, it seems the sources for the Batch files are somewhere hidden in the PixInsight application itself on the Mac. 

I will search again to see what I can find on my Max.

Thx,

-Jeff

Offline SanDiegoAstro

  • Newcomer
  • Posts: 15
Re: Writing my first JavaScript- Help
« Reply #3 on: 2013 July 30 07:01:53 »
To add a bit more detail, it seems when I open the Feature Scripts from the Scripts menu, I can see a bunch of .js files.   However, they seem to be in the following location which I cannot figure out how to access:

/Applications/PixInsight.app/Contents/src/scripts/.....

So it seems that the scripts are bundled in the application itself.   So how would I access those files?

thx!

Offline SanDiegoAstro

  • Newcomer
  • Posts: 15
Re: Writing my first JavaScript- Help
« Reply #4 on: 2013 July 30 07:12:29 »
I think I just figured it out.   You have to open the application package and they seem to be inside.

Thx!

Offline pfile

  • PTeam Member
  • PixInsight Jedi Grand Master
  • ********
  • Posts: 4729
Re: Writing my first JavaScript- Help
« Reply #5 on: 2013 July 30 09:29:33 »
or from Terminal.app you can just cd there. or open <path> will open a finder window directly on that folder...

rob