Skip to main content
Known Participant
July 8, 2010
Answered

How can I find the Scripts directory from a script?

  • July 8, 2010
  • 1 reply
  • 3765 views

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 🙂

This topic has been closed for replies.
Correct answer Paul Tuersley

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

1 reply

Paul TuersleyCorrect answer
Inspiring
July 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));

Known Participant
July 14, 2010

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