applescript

Find out why the . goes before the /

Moderator: Paul Tuersley

Post Reply
slawes
Posts: 25
Joined: December 9th, 2006, 12:38 pm
Location: LA, California

I often think that some of the simplest things can be the most annoying.
Here is a prime example -
I want to launch a specific ae script from an applescript, but the DoScript command seems to be looking at the file as a script rather than a file of a script. That's sounds confusing so here's the script -

on open these_items
tell application "Adobe After Effects 7.0"
launch
activate
open these_items
set thefile to "/Rocket_1_g5/Applications/Adobe After Effects 7.0/Scripts/DemoPalette.jsx"
DoScript thefile
end tell
end open

The error I get is -
Unable to execute script at line 1.Expected:;

I tried the version of the similar applescript on page 8 of the ae scripting guide which works just fine, but I don't want the user to choose the file, I want to specify the file in the script.

I would really appreciate any help,
Thanks,
Stephen.
zold

Hi.
I know you saw this solution already, Stephen, but here is a 're-print' from creativecow, just in case anyone else is curious about this sort of thing:

Hi Stephen.
Here's the solution.
I'm assuming these_items is a variable containing drag/dropped files in the finder (projects or footage items, perhaps).
Realize that the DoScript command is an AppleScript command, and therefore expects the parameter to be either a (text) string of the script itself (like

Code: Select all

alert('wow');
, or a file specification of a script file. In AppleScript parlance, this means either a file specification

Code: Select all

file file_path
, an alias

Code: Select all

alias file_path
, or a file path string. The simplest form of this is probably a file path, but using Posix form (with the forward slashes and tricky characters in need of escaping) is not the default AppleScript way, so you use this format:

Code: Select all

"Rocket_1_g5:Applications:Adobe After Effects 7.0:Scripts:DemoPalette.jsx"
, assuming Rocket_1_g5 is the hard drive name. You can also do something like:
--(watch out for word wrap; this is one line:)

Code: Select all

tell application "Finder" to set theFile to (startup disk as text) & "Applications:Adobe After Effects 7.0:Scripts:DemoPalette.jsx"
And anytime you want to get the correct file path, you just copy the results of running the "choose file" command. That's what you should've done first to get the correct file path to paste into your script.
You're on your way ...

CG
slawes
Posts: 25
Joined: December 9th, 2006, 12:38 pm
Location: LA, California

Thanks, I should have done that already.

-Stephen.
Post Reply