Skip to main content
Known Participant
June 7, 2016
Answered

JSX Launch Windows Explorer Folder to path?

  • June 7, 2016
  • 1 reply
  • 2148 views

From the googling/reading is seems this might be a security restriction of Javascript, but thought I'd ask anyway!

Does anyone know if its possible to launch a Windows Explorer window to a specific path? (will be a variable defined earlier in a script)

Thanks!

This topic has been closed for replies.
Correct answer vinothr

Folder object's execute method can be used to open the folder in platform-specific file browser.

For example, if your folder path is E:\\myfolder.

var myfold = new Folder("E:\\myfolder");

myfold.execute() // will open platform-specific file browser

execute method returns true if folder was opened successfully.

1 reply

vinothr
vinothrCorrect answer
Inspiring
June 7, 2016

Folder object's execute method can be used to open the folder in platform-specific file browser.

For example, if your folder path is E:\\myfolder.

var myfold = new Folder("E:\\myfolder");

myfold.execute() // will open platform-specific file browser

execute method returns true if folder was opened successfully.

Known Participant
June 7, 2016

perfect thankyou!

Trevor:
Legend
June 8, 2016

Hi

The answer give will open Explorer to a given folder which sounds like what you want.

If you wanted an actual file selected then you could use the following.

if ($.os[0] === "W") { // Running VBS on Windows

    var vbs, f;

    f = new File (app.filePath + "/InDesign.exe"); // change to the file location you want

    // i.e. f = new File ("c:/myFolder/myFile"); got it?

    vbs = 'CreateObject("Wscript.Shell").Run "explorer.exe /select, ""' + f.fsName + '"""';

    app.doScript (vbs, ScriptLanguage.VISUAL_BASIC);

} else { // Running VBS on Mac

    alert("Jerk");

}

Trevor