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

system.callSystem and osascript

Contributor ,
Dec 17, 2013 Dec 17, 2013

Hi guys,

I'm trying to write a function that will run some AppleScript to load a newly created script into After Effects.  I've tried a couple of ways of doing it...straight AppleScript, AppleScript file...but can't seem to figure it out.  I'm a little unsure about the relationship between system.callSystem and the use of the osascript command.

Here is the closest I've gotten it to working...functionality builds the osascript call:

osascript -e 'tell application "Adobe After Effects CS6"' -e 'activate' -e 'DoScriptFile "pathToFile"' -e 'end tell'

I've also tried putting the AppleScript into a file and running the file via osascript:

osascript script.scpt

When I run both commands directly in Terminal, they work.  However, when I run them within system.callSystem...I get the mac "thinking" wristwatch and after about 20-30 seconds, After Effects comes back without having run the command properly. 

The return value from system.callSystem is "script.scpt: execution error: Adobe After Effects CS6 got an error: AppleEvent timed out. (-1712)"

Do I need to wrap the osascript calls within a "tell application "Terminal"..." block?  How should I go about doing that? Any thoughts on how to run AppleScript functionality from with an AE script?

Another thought I had was that I wasn't properly escaping spaces and double quotes but I would assume if that were the case the error wouldn't be about timing out.

Any help is greatly appreciated!

TOPICS
Scripting
1.2K
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
Enthusiast ,
Dec 17, 2013 Dec 17, 2013
LATEST

It sounds like the timeout issue is a recursion problem.  Through ExtendScript, you are telling AE to do something via AppleScript, but the system.callSystem() command is already busy executing the script that called for the AppleScript to do its task.  You can most certainly use osascript in the system.callSystem() method, but you probably cannot ask the running instance of AE to do something for you.  You could, however, launch a new instance of AE from your AppleScript and tell that newly instatiated AE to do what you want.

Not sure if what I am saying helps you because I am only hypothesizing as to what's going on.

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