Skip navigation
Currently Being Moderated

Unable to call applescript from extension[CS6]

Apr 29, 2013 2:20 AM

Hi,

 

I need to mount the directory automatically through code. To accomplish this I've a Applescript but to run that script from action script I need do script to run. I saw the code in "http://forums.adobe.com/message/3238998" but I see actually there is no attribute called APPLESCRIPT_LANGUAGE in API. It has script language VB script and javascript but no applescript. I'm using flex 4 for InDesign CS6 Extension.

 

var app:Application = InDesign.app;
    if(OS.toLowerCase() == 'mac')
       {
           var applescript:File = new File("AutoMounting.scpt");
               app.doScript(applescript.nativePath, ScriptLanguage.?);
  
        }
 
 

 

Could some one help me out to get this done ?


Many Thanks in advance.

 

Mac

 
Replies
  • Currently Being Moderated
    Apr 29, 2013 10:18 AM   in reply to Mac_06

    To run the script, you can use the NativeProcess API to launch the native script utility ("osascript" on Mac). Here's a quick example:

     

    var scriptFile:File = new File('yourscript.scpt');
    var scriptUtility:File = new File('/usr/bin/osascript');
    if (scriptUtility.exists) {
         var processInfo:NativeProcessStartupInfo = new NativeProcessStartupInfo();
         processInfo.executable = scriptUtility;
         processInfo.arguments = new Vector.();
         processInfo.arguments.push(scriptFile.nativePath);
    
         var process:NativeProcess = new NativeProcess();
         process.start(processInfo);
    }
     
    |
    Mark as:

More Like This

  • Retrieving data ...

Bookmarked By (0)

Answers + Points = Status

  • 10 points awarded for Correct Answers
  • 5 points awarded for Helpful Answers
  • 10,000+ points
  • 1,001-10,000 points
  • 501-1,000 points
  • 5-500 points