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

ScriptUI get path to indesign install directory

Explorer ,
Apr 02, 2012 Apr 02, 2012

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
2.5K
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 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

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

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.

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

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

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

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

                    }

                    if (! scriptsFolder.exists){

                              scriptsFolder = null;

                              break;

                    }

          }

          while (false);

          return scriptsFolder;

}

Harbs

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

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.

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

Can't you just use:

var appFolder = Folder.startup;

?

--

Marijan (tomaxxi)

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

Only on Windows.

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