Running scripts from the command line: Scripting Guide ERROR

Find out why the . goes before the /

Moderator: Paul Tuersley

Post Reply
davestewart
Posts: 114
Joined: March 10th, 2005, 5:50 am
Location: London, UK
Contact:

March 4th, 2006, 2:35 am

The example code in the Scripting Guide to launch scripts from the command line contains a grammatical error, that will cause your scripts NOT to run.

Basically, the code therin is formatted using an em-dash – rather than a hyphen - (as Windows expects). If you were to copy and paste the code to a fixed-width code editor, both the characters above would display identically:

Code: Select all

 - (hyphen)
 – (dash)
When in actual fact they are completely different:
- (hyphen)
– (dash)
Therefore running the code, even for testing purposes, will launch After Effects, but throw the error: "After Effects error: invalid file location specification (must include name)."

This may lead you to the conclusion that:

a) your script path is wrong
b) you've badly formatted the quotes
c) you're insane

The real answer is "none of the above". Once After Effects reaches the em-dash, it will just presume that you neglected to enter a path.

End result - TYPE the code yourself and save the headaches, or copy and paste the following code:

Code: Select all

afterfx.exe -s "alert ('You just sent an alert to After Effects')"
afterfx.exe -r c:\temp\yourAEScriptHere.jsx

Happy programming :)
ulikilian
Posts: 13
Joined: April 28th, 2009, 8:11 am

June 4th, 2009, 3:44 am

Hi all,
I want to point something out which gave me quite a headake and maybe I can prevent others from having the same.

The line dave pointed out works well:

Code: Select all

afterfx.exe -r c:\temp\yourAEScriptHere.jsx
This line does also work as expected:

Code: Select all

afterfx -r "c:\temp\yourAEScriptHere.jsx"
But this line throws an error ("no read access to file"):

Code: Select all

afterfx.exe -r "c:\temp\yourAEScriptHere.jsx"
I'm sure there is a proper explanation for this, but it's not very straight forward: Why is the interpretation of quotes handled differently depending on writing ".exe" after the application name?
Anyway - keep it in mind:
If you use quotes, don't write ".exe" after "afterfx"!
(btw: WinXP Pro 64-bit SP2, After Effects running in 32-bit)

Happy programming :)
Redsandro
Posts: 108
Joined: June 25th, 2008, 4:55 pm

September 10th, 2009, 8:30 am

Exactly! I never understood it had to do with writing .exe or not!

Without .exe it works fine, but with .exe and quotes my After Effects sais "You don't have permission to read this file."

I always thought it depended on whether or not After Effects was having one of those days. But apparently sometimes I type .exe and sometimes I don't.

Thanks for mentioning it.
avi + m2t -> Vdub + DGIndex -> AE CS3 -> x264 -> Hell On Earth :mrgreen:
Post Reply