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

ScriptUI get path to indesign install directory

Explorer ,
Apr 02, 2012 Apr 02, 2012

Copy link to clipboard

Copied

Does anyone know if there is a way to get a users path to their install directory?

I have script, that creates a new menu item when Indesign starts up.  the menu item is clicked, it opens another script.

Right now, I have the path to the second script hardcoded, which works fine:

     C:\Program Files (x86)\Adobe\Adobe InDesign CS5.5\Scripts\Scripts Panel\DM_Core\DM_RemoveMenu.vbs

but now I have to give this to other users, and I need to know if there is some way to get the installation path that they have to their indesign.

Ultimately, what I would like to get is this:

     C:\Program Files (x86)\Adobe\Adobe InDesign CS5.5\Scripts

I have tried scriptsFolder but that doesn't take me to the right place.

Anyone have any ideas.

Thanks,

TOPICS
Scripting

Views

2.2K

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 1 Correct answer

LEGEND , Apr 03, 2012 Apr 03, 2012

This should get you what you want:

function GetScriptsFolder (){

          var scriptsFolder = null;

          do{

          // On Mac this is a folder inside the app package

                    var appFolder = Folder.startup;

                    if (! appFolder.exists){break;}

                    scriptsFolder = Folder(appFolder + "/Scripts");

                    while (appFolder.exists && ! scriptsFolder.exists){

                              appFolder = appFolder.parent;

                              s

...

Votes

Translate

Translate
Community Expert ,
Apr 02, 2012 Apr 02, 2012

Copy link to clipboard

Copied

Where did you get "scriptsFolder" from? Your current scripts' folder?

Anyway, check how far you come with the standard list: http://jongware.mit.edu/idcs5js/pc_Folder.html

These variables get filled by ID with the correct paths; for anywhere else, you're own your own. Make sure your path is valid under both Mac OS X and under Windoze, as there are a few differences.

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
LEGEND ,
Apr 02, 2012 Apr 02, 2012

Copy link to clipboard

Copied

Note that the path to a script changes when run from the ESTK versus the Scripts Panel.

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
LEGEND ,
Apr 03, 2012 Apr 03, 2012

Copy link to clipboard

Copied

This should get you what you want:

function GetScriptsFolder (){

          var scriptsFolder = null;

          do{

          // On Mac this is a folder inside the app package

                    var appFolder = Folder.startup;

                    if (! appFolder.exists){break;}

                    scriptsFolder = Folder(appFolder + "/Scripts");

                    while (appFolder.exists && ! scriptsFolder.exists){

                              appFolder = appFolder.parent;

                              scriptsFolder = Folder(appFolder + "/Scripts");

                    }

                    if (! scriptsFolder.exists){

                              scriptsFolder = null;

                              break;

                    }

          }

          while (false);

          return scriptsFolder;

}

Harbs

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
Explorer ,
Apr 03, 2012 Apr 03, 2012

Copy link to clipboard

Copied

Thanks all you guys, but Harbs got me closest to where I needed to be.  I had to tweak it a little bit, but it set me on the right path.

I would have said thanks earlier, but the forum wasn't letting me reply.

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
Advisor ,
Apr 04, 2012 Apr 04, 2012

Copy link to clipboard

Copied

Can't you just use:

var appFolder = Folder.startup;

?

--

Marijan (tomaxxi)

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
LEGEND ,
Apr 04, 2012 Apr 04, 2012

Copy link to clipboard

Copied

LATEST

Only on Windows.

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