File.execute() is not executing my script. How to debug this issue?

Viewed 2166

I'm writing a script for Illustrator CS6 in ExtendScript. At the end of my script, I want to spawn a task (a second script, in Ruby) using File.execute(). However, it's not working. And I'm at a loss as how to debug the problem -- how can I figure out why this isn't working?

Here's the end of my ExtendScript file:

// Do a bunch of other work, then:
var rubyFile = new File(scriptFolder + 'BuildHtmlWalkthrough.rb');
alert(rubyFile.exists);
var result = rubyFile.execute(); 
alert(result);

Both rubyFile.exists and result are always true, indicating that the script launched OK. But the script does not appear to run, at all. I've tried the following diagnostics:

  • The Ruby script does successfully run from the command line. The script's permissions are -rwxr-xr-x
  • I added a call to system("touch /blah/blah/blah") as the very first line of the Ruby script. The file does not get touched.
  • I thought maybe the ExtendScript process was terminating before the Ruby script could run, so I added a long for loop after rubyFile.execute(). Spinning for > 30 seconds did not help.

What can I do to debug, or solve, this problem?

I'm on MacOS X v10.9.1. And for reference, this is the documentation for File.execute():

File.execute (): Boolean

Core JavaScript Classes

Executes or opens this file using the appropriate application, as if it had been double-clicked in a file browser. You can use this method to run scripts, launch applications, and so on. Returns true immediately if the application launch was successful.

1 Answers
Related