Exit
  • Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
  • 한국 커뮤니티
0

Open any Folder Path from InDesign javaScript

Enthusiast ,
Jun 28, 2020 Jun 28, 2020

Dear Pros.

 

Is it Possible to Open any Folder Path from InDesign JavaScript? and How to?

 

Thanks in Advance

Best Regards

Mohammad

Best
Mohammad Hasanin
TOPICS
Scripting
3.0K
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines

correct answers 2 Correct answers

Community Expert , Jun 28, 2020 Jun 28, 2020

Hi,

Try following snippet

var path = "~/Desktop";
var folder = Folder(path);
if(folder.exists)
    folder.execute();

 

Let us know if this works for you.

Translate
Advocate , Jun 28, 2020 Jun 28, 2020

Yes Mohammad,

It is possible to open any folder path using InDesign JavaScript.

For Windows user if folder is locked by adminstrative, then code won't be able to open that folder.

Folder can be opened using this code :

var folderPath = "D:/Temporary Folder/SunilTestFolder";

if(Folder(folderPath).exists){

    Folder(folderPath).execute();

}

 

 

Best

Sunil

Translate
Community Expert ,
Jun 28, 2020 Jun 28, 2020

Hi,

Try following snippet

var path = "~/Desktop";
var folder = Folder(path);
if(folder.exists)
    folder.execute();

 

Let us know if this works for you.

Best regards
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Enthusiast ,
Jun 28, 2020 Jun 28, 2020

Thank you very much

Best
Mohammad Hasanin
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Advocate ,
Jun 28, 2020 Jun 28, 2020

Yes Mohammad,

It is possible to open any folder path using InDesign JavaScript.

For Windows user if folder is locked by adminstrative, then code won't be able to open that folder.

Folder can be opened using this code :

var folderPath = "D:/Temporary Folder/SunilTestFolder";

if(Folder(folderPath).exists){

    Folder(folderPath).execute();

}

 

 

Best

Sunil

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Enthusiast ,
Jun 28, 2020 Jun 28, 2020

Thank you very much sunil

Best
Mohammad Hasanin
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Enthusiast ,
Jun 28, 2020 Jun 28, 2020

This script to select any folder path:

var myFolder = Folder.selectDialog ("Select a folder");
if(myFolder != null){
if(myFolder instanceof Folder){
alert("fsName: " + myFolder.fsName);
alert("fullName: " + myFolder.fullName);
alert("name: " + myFolder.name);
}
}

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Enthusiast ,
Jun 28, 2020 Jun 28, 2020
LATEST

Thank you a lot

Best
Mohammad Hasanin
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines