Author Topic: running Java Script files  (Read 5781 times)

Offline enzosantin

  • Member
  • *
  • Posts: 59
    • http://www.enzosantin-astro.com
running Java Script files
« on: 2007 February 06 03:24:15 »
Hi all,
sorry, but I have a question:
how I can run a java script file in PixInsight SE? If I attempt to run a js file in the processing console (or in script editor) with this command line:

"run C:\Programmi\Pleiades Astrophoto\PixInsight-beta\PCL\examples\js\test.js" (the path is correct)

I get this error message:

"Processing script file: C:/Programmi/Pleiades

File I/O Error: Unable to open file:
C:/Programmi/Pleiades

Processing script file: C:/PROGRAMMI/PLEIADES ASTROPHOTO/PIXINSIGHT-BETA/PCL/BIN/Astrophoto/PixInsight-Beta/PCL/examples/js/test.js

File I/O Error: Unable to open file:
C:/PROGRAMMI/PLEIADES ASTROPHOTO/PIXINSIGHT-BETA/PCL/BIN/Astrophoto/PixInsight-Beta/PCL/examples/js/test.js"

Obviously the path is wrong...  :cry:

Many thanks!

Enzo Santin

Offline Apollo

  • Newcomer
  • Posts: 15
running Java Script files
« Reply #1 on: 2007 February 06 03:41:39 »
Enzo,

The first error "File I/O Error: Unable to open file" seems to suggest that perhaps you need to put quotes around the complete path due to the space in the path name (the one between the "Pleiades Astrophoto" part of the path). You have to do this in on a windows command prompt, so perhaps you have to do the same in PI.

I've no idea if this will work mind, but if not i'm sure one of the PI team will step in to help you out!

Cheers,
  Simon.

Offline Juan Conejero

  • PTeam Member
  • PixInsight Jedi Grand Master
  • ********
  • Posts: 7111
    • http://pixinsight.com/
running Java Script files
« Reply #2 on: 2007 February 06 05:52:59 »
Hi Enzo,

Simon is right: the problem is the space in the file path:

"C:\Programmi\Pleiades*Astrophoto..."

The run command considers this as two arguments: one is "C:\Programmi\Pleiades" and the second one is the rest of the string.

Always use double quotes to specify a path that contains white spaces. This is applicable to any command that accepts path specifications.

Having said that, I have to say thank you now because you've found a bug :lol:  The new Script Editor interface also has the same problem (it also uses the run command to execute scripts), that is, I forgot to enclose paths between quotes when building the run command that the Script Editor sends to the console. I'll publish a new version today that fixes this.

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

Offline Juan Conejero

  • PTeam Member
  • PixInsight Jedi Grand Master
  • ********
  • Posts: 7111
    • http://pixinsight.com/
running Java Script files
« Reply #3 on: 2007 February 06 06:10:12 »
Enzo and Simon,

Last minute update: The latest build 248 seems to have a regression that causes command-line arguments enclosed by quotes to be misinterpreted by the console command parser.

This means that the run command won't work with a path specification like "/my script/with spaces.js", even if it is enclosed by double quotes. I'm working on this issue right now, and it will be fixed today. For now, please use file and directory names with no whitespace. Sorry for the inconvenience.

Thanks again for your patience.
Juan Conejero
PixInsight Development Team
http://pixinsight.com/