Skip to main content
rob day
Community Expert
Community Expert
October 1, 2019
Question

Execute NativeProcess

  • October 1, 2019
  • 1 reply
  • 312 views

I have a Mac OSX AIR desktop app and would like to launch an AppleScript saved as an App using NativeProcess.

 

Here's the code:

var mailScript:File = File.applicationStorageDirectory.resolvePath("scripts/SendMail");

var scriptStartup:NativeProcessStartupInfo = new NativeProcessStartupInfo();
var scriptProcess:NativeProcess = new NativeProcess();
scriptStartup.executable = mailScript;
//scriptProcess.start(scriptStartup);

trace(mailScript.nativePath); //returns the path to the AppleScript App
trace(NativeProcess.isSupported); //Returns true

 

The executable line throws an error: Error #3214: NativeProcessStartupInfo.executable does not specify a valid executable file.

 

Is it possible to start an AppleScript saved as an application? It shows as a process in Activity Monitor.

The documentation has this note. I'm using the path to the app file—not sure what they mean by full path to the executable:

Note: On Mac OS, to launch an executable within an application bundle, be sure to have the path of the File object include the full path to the executable (within the bundle), not just the path to the app file.  

 

 

 

 

    This topic has been closed for replies.

    1 reply

    rob day
    Community Expert
    rob dayCommunity ExpertAuthor
    Community Expert
    October 1, 2019

    Figured it out, it was the path. I had to drill down into the app package—this worked:

     

    var mailScript:File = File.applicationStorageDirectory.resolvePath("scripts/SendMail.app/Contents/MacOS/applet");