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

Execute NativeProcess

Community Expert ,
Oct 01, 2019 Oct 01, 2019

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.  

 

 

 

 

327
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
Community Expert ,
Oct 01, 2019 Oct 01, 2019
LATEST

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");

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