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

How can I find the Scripts directory from a script?

New Here ,
Jul 08, 2010 Jul 08, 2010

Hello all! After playing with Photoshop scripting, I'm now playing with AE too, and in my first try I've stuck in finding the scripts path from the script itself.

In Photoshop, there was this piece of code that somebody in the Photoshop Scripting forum kindly shared:

var scriptsPath = new Folder (app.path + "/" + localize ("$$$/ScriptingSupport/InstalledScripts=Presets/Scripts"));

But this line doesn't work in After Effects because app.path variable doesn't exist (very funny, I thought Photoshop and After Effects shared the same basic app variables) and the path given to the "localize" function is wrong in AE (I think "$$$" means nothing to it).

Can somebody give me a clue about how to solve this? Thanks a lot in advance 🙂

TOPICS
Scripting
3.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

Enthusiast , Jul 14, 2010 Jul 14, 2010

This script shows a couple of examples you can try. The first part shows a way to get the folder the running script is in. The second gets the main AE app folder although I don't know if appFolder works on Windows (you'd still need to add /Scripts on Mac or /SupportFiles/Scripts on Win).

var thisScript = new File($.fileName);

var containingFolder = new Folder(thisScript.parent.absoluteURI);

alert("This script is in " + containingFolder.absoluteURI);

var appFolder = new Folder(Folder.appPackage.paren

...
Translate
Enthusiast ,
Jul 14, 2010 Jul 14, 2010

This script shows a couple of examples you can try. The first part shows a way to get the folder the running script is in. The second gets the main AE app folder although I don't know if appFolder works on Windows (you'd still need to add /Scripts on Mac or /SupportFiles/Scripts on Win).

var thisScript = new File($.fileName);

var containingFolder = new Folder(thisScript.parent.absoluteURI);

alert("This script is in " + containingFolder.absoluteURI);

var appFolder = new Folder(Folder.appPackage.parent.absoluteURI);

alert("The app folder is at " + Folder.decode(appFolder.absoluteURI));

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
New Here ,
Jul 14, 2010 Jul 14, 2010
LATEST

It works! The second option is better for me, as I'm developing with ExtendScript and the script file is not in the script directory yet.

Thanks a lot, Paul

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