Author Topic: How to address a folder for Windows  (Read 523 times)

Offline aworonow

  • PixInsight Addict
  • ***
  • Posts: 258
    • Faint Light Photography
How to address a folder for Windows
« on: 2019 October 10 12:38:00 »
Hi, I'm trying to use Vincent's script for repairing defects in image, in batch mode. It requires that I specify the input and output directories. I'm using Windows 10. How does one format the required the path? I've tried

"I:/temp/input" & "I:/temp/input/"
"I://temp//input" & "I://temp//input//"
"I:\temp\input" & "I:\temp\input\"

and probably 5 or 6 other things. (My I-drive is an external drive.) All throw an error of directory not found. Strangely, I was able to access a directory to write the defects found by Vincent's script, but cannot address the directory with the images in order to fix them.

Thanks in advanced...Alex

Offline Geoff

  • PixInsight Padawan
  • ****
  • Posts: 908
Re: How to address a folder for Windows
« Reply #1 on: 2019 October 10 21:31:36 »
I don’t know what the reason is, but I found the the following scheme works:
C:/folder
But if I try
C:/folder1/folder2
things don’t work
Geoff
Don't panic! (Douglas Adams)
Astrobin page at http://www.astrobin.com/users/Geoff/
Webpage (under construction) http://geoffsastro.smugmug.com/

Offline Juan Conejero

  • PTeam Member
  • PixInsight Jedi Grand Master
  • ********
  • Posts: 7111
    • http://pixinsight.com/
Re: How to address a folder for Windows
« Reply #2 on: 2019 October 11 04:39:14 »
UNIX path separators (single slash characters '/') work on all platforms in PixInsight, including Windows, and should always be used. They have an important advantage over native Windows backslash separators: you don't have to escape a single backslash.

For example, the following path specifications are equivalent on Windows:

"C:/foo/bar"
"C:\\foo\\bar"

Note that since the backslash character is the standard escape character in C, C++ and JavaScript, you have to write two backslashes in order to specify a single backslash in a string literal. The following is incorrect as a path specification:

"C:\foo\bar"

because the 'f' and 'b' characters are being escaped. In this particular example, \f is being replaced with a form feed control character (ASCII code 12) and \b is replaced with a backspace control character (ASCII code 8).

Quote
C:/folder1/folder2
things don’t work

This should not happen. In PixInsight, "C:/folder1/folder2" is a valid path specification on Windows, as far as "C:", "folder1" and "folder2" exist in the order specified and are accessible to the current user.
Juan Conejero
PixInsight Development Team
http://pixinsight.com/

Offline aworonow

  • PixInsight Addict
  • ***
  • Posts: 258
    • Faint Light Photography
Re: How to address a folder for Windows
« Reply #3 on: 2019 October 11 06:22:29 »
Thanks Geoff and Juan,
Geoff, as you suggest, the single-subdirectory seems to work, but paths beyond that do not. Strange!

Offline Juan Conejero

  • PTeam Member
  • PixInsight Jedi Grand Master
  • ********
  • Posts: 7111
    • http://pixinsight.com/
Re: How to address a folder for Windows
« Reply #4 on: 2019 October 11 08:19:55 »
They work if properly used. For example, on Windows, enter this command on the Process Console window:

j File.readTextFile( "C:/Program Files/PixInsight/src/scripts/AdP/messier.txt" )

and you'll see the entire Messier catalog printed on the console. This example uses JavaScript code.

Try also the following command in Process Console:

ls C:/Windows/System32/*.exe

This prints a long list of executable files on the standard "C:/Windows/System32" folder. For folder or file names with spaces, you have to enclose the path between quotes:

ls "C:/Program Files/PixInsight/bin/*-pxm*"

which prints a list with all PixInsight modules.
Juan Conejero
PixInsight Development Team
http://pixinsight.com/