Page 1 of 1

Default directory

Posted: March 3rd, 2006, 7:18 pm
by davestewart
Hi All,
It's been a while since I've touched AE scripting, and I've (probably) forgotten the answer to this one.

Is there any way to set a default or working directory - other than the AE Script directory? I want to set it so a user can run scripts from an external application, and have AE operate on that particular folder by default (without a long protracted path name, every time).

ie...

Code: Select all

setActiveDirectory('c:\temp\scripts')
Then, later, when I do something like...

Code: Select all

f=file('sample.txt')
... it knows where it is!

Thanks,
Dave

Posted: March 3rd, 2006, 8:12 pm
by davestewart
I'll play with

Code: Select all

Folder.current

Posted: March 4th, 2006, 12:20 am
by vidpat
You could always stick the path in a variable and concatenate it with the file name, as needed:

Code: Select all

var cwd = "C:\\temp\\scripts\\";

// ...

f = file(cwd + "sample.txt");

Posted: March 4th, 2006, 2:09 am
by davestewart
Thanks vidpat,

Sure I could - and that's probbaly what I'll end up doing.

For the record, Folder.current only worked for teh current evaluation of a script. As soon as it was done executing, Folder.current reverted back to /Support Files.

It seems odd (but understandable) that you can't set it!

Any more ideas?

Thanks,
Dave