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

Open any Folder Path from InDesign javaScript

Enthusiast ,
Jun 28, 2020 Jun 28, 2020

Copy link to clipboard

Copied

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

Views

2.4K

Translate

Translate

Report

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.

Votes

Translate

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

Votes

Translate

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

Copy link to clipboard

Copied

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

Votes

Translate

Translate

Report

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

Copy link to clipboard

Copied

Thank you very much

Best
Mohammad Hasanin

Votes

Translate

Translate

Report

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

Copy link to clipboard

Copied

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

Votes

Translate

Translate

Report

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

Copy link to clipboard

Copied

Thank you very much sunil

Best
Mohammad Hasanin

Votes

Translate

Translate

Report

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

Copy link to clipboard

Copied

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);
}
}

Votes

Translate

Translate

Report

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

Copy link to clipboard

Copied

LATEST

Thank you a lot

Best
Mohammad Hasanin

Votes

Translate

Translate

Report

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