Thanks a lot for the help Glen,

One more question, I am using flex builder 3 and flex SDK 3.2.0, But I am
not able to find the nativeprocess API in this configuration. I tried
overlaying adobe air 2.0 on flex SDK 3.2.0 as mentioned in some forums but
still it does not work. Do I need flash builder 4 to make the nativeprocess
API work. 

Thanks Again,
Sumeet Kumar



 



-----Original Message-----
From: flashcoders-boun...@chattyfig.figleaf.com
[mailto:flashcoders-boun...@chattyfig.figleaf.com] On Behalf Of Glen Pike
Sent: Wednesday, July 20, 2011 2:35 PM
To: Flash Coders List
Subject: Re: [Flashcoders] Calling applescript from Adobe AIR

Hi,

     Not sure, but if AppleScript files can be executable like shell scripts
in Linux, then you can call them from Air desktop using the Native Process
API.

     If you download Air Launchpad and get it to generate the source code
example for the Native Process API, you can then hack it to try your code,
see my example below which starts an SSH session using putty on Windows -
did not try on Mac as I don't have one, but should also be able to make it
work on Linux.

     Glen

protected function runProcess():void
             {
                 var file:File = new File();
                 try
                 {
                    if (Capabilities.os.toLowerCase().indexOf("win") > -1)
                     {
                         file = new File("C:\\Documents and
Settings\\Will\\Desktop\\Downloads\\Progs\\putty.exe");
                     }
                     else if
(Capabilities.os.toLowerCase().indexOf("mac") > -1)
                     {
                         file = new File("/sbin/ssh");
                         if (file == null)
                             file = new File("/bin/ssh");
                         else if (file == null)
                             file = new File("/usr/bin/ssh");
                     }
                     else if
(Capabilities.os.toLowerCase().indexOf("linux") > -1)
                     {
                         file = new File("/sbin/ssh");
                         if (file == null)
                             file = new File("/bin/ssh");
                         else if (file == null)
                             file = new File("/usr/bin/ssh");
                     }

                     var
nativeProcessStartupInfo:NativeProcessStartupInfo = new
NativeProcessStartupInfo();
                     nativeProcessStartupInfo.executable = file;
                     var args:Vector.<String> = new Vector.<String>;
                     args.push("-P");
                     args.push("50030")
                     args.push("-l");
                     args.push("username");
                     args.push("-pw");
                     args.push("password");
                     args.push("-L");
                     args.push("2080:localhost:2080");
                     args.push("-L");
                     args.push("7766:localhost:7766");
                     args.push("192.168.0.19");
                     nativeProcessStartupInfo.arguments = args;
                     process = new NativeProcess();
                     process.start(nativeProcessStartupInfo);

                     
process.addEventListener(ProgressEvent.STANDARD_OUTPUT_DATA, onStdout);
                     
process.addEventListener(ProgressEvent.STANDARD_ERROR_DATA, onError);
                 }
                 catch (e:Error)
                 {
                     Alert.show(e.message, "Error");
                 }
             }

On 20/07/2011 07:42, Sumeet Kumar wrote:
> Hi All,
>
>
>
> Is there any way by which I can call Applescript from Adobe air?
>
> Any help or suggestion on this regard would be great.
>
>
>
> Regards
>
> Sumeet Kumar
>
> _______________________________________________
> Flashcoders mailing list
> Flashcoders@chattyfig.figleaf.com
> http://chattyfig.figleaf.com/mailman/listinfo/flashcoders
>

_______________________________________________
Flashcoders mailing list
Flashcoders@chattyfig.figleaf.com
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders


_______________________________________________
Flashcoders mailing list
Flashcoders@chattyfig.figleaf.com
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders

Reply via email to