This site is optimised for Firefox 2.0 or Internet Explorer 7.

AS3 call applescript?

User avatar
willcrain
 
Post Count: 18
Joined: Fri Nov 14, 2008 6:22 pm
Location: new york
Flash Version: Adobe Flash CS4

AS3 call applescript?

Postby willcrain on Thu Jul 16, 2009 4:25 pm

I am trying to make a flash app that when you click on a certain button it will call an applescript that is in a folder. Does anyone know how to do this? or if it can be done? Any insight would be appreciated. thanks

will

User avatar
drukepple
 
Post Count: 1647
Joined: Tue Mar 28, 2006 4:32 pm
Location: Hood River, OR

Re: AS3 call applescript?

Postby drukepple on Thu Jul 16, 2009 5:55 pm

The only way that I'm aware of this working is through using fscommand. There are specific rules, and limitations, but it can be done. The biggest problem is that you can't pass variables to the AppleScript, nor get values in return, or even really know when the AppleScript has completed. And another of the rules/limitations is that this has to be done from a projector, it can't be done from a SWF running in the browser or the standalone player. I am not sure if an AIR app will let you run the AppleScript through fscommand. But if it could, then there's potentially a way around the argument/return issue. I would theorize that you could write your arguments out to a temporary text file, then run the AppleScript, which could read that text file and parse out the arguments, run its thing, and perhaps write out return data back into the text file. The thing is knowing when the AppleScript has finished; I suppose you could poll the text file every few seconds until you see a change...

Well, all of that is speculation anyway, as my hunch would be that you couldn't run fscommand AppleScripts from AIR in the first place. But it's worth looking into. The docs do mention the "exec" only works from a projector.

So, I had been sitting on a blog post that describes how to do this fscommand thing for a while, and this question prompted me to finish it up, and post it, so that I could just link to it to give you the details you need, if that's the solution that would work for you:

http://summitprojectsflashblog.wordpress.com/?p=738
Dru Kepple
ActionScripter
Summit Projects
http://www.summitprojects.com
http://summitprojectsflashblog.wordpress.com

I love deadlines. I like the whooshing sound they make as they fly by.
:: Douglas Adams

User avatar
willcrain
 
Post Count: 18
Joined: Fri Nov 14, 2008 6:22 pm
Location: new york
Flash Version: Adobe Flash CS4

Re: AS3 call applescript?

Postby willcrain on Thu Jul 16, 2009 6:29 pm

Thanks a lot drukepple. Thats exactly what i needed to know. I thought that it was going to be more involved than that though. Making it harder on myself. Thanks again.

will

User avatar
Jasconius
 
Post Count: 88
Joined: Fri Jul 11, 2008 9:24 pm
Location: Fort Myers, FL
Flash Version: Adobe Flash CS4

Re: AS3 call applescript?

Postby Jasconius on Thu Jul 16, 2009 8:53 pm

It would probably be easier to write something in Cocoa that listened for something up on a web server somewhere.

I do not specifically what you are doing, but my thoughts immediately ran to native app that pings a web server for instructions at a set interval.
http://jasconius.com/ - The occasional update on various programming related things.

User avatar
drukepple
 
Post Count: 1647
Joined: Tue Mar 28, 2006 4:32 pm
Location: Hood River, OR

Re: AS3 call applescript?

Postby drukepple on Thu Jul 16, 2009 9:44 pm

That's funny. Your definition of "easier" must be different from mine.
Dru Kepple
ActionScripter
Summit Projects
http://www.summitprojects.com
http://summitprojectsflashblog.wordpress.com

I love deadlines. I like the whooshing sound they make as they fly by.
:: Douglas Adams


Return to Actionscript 3.0

Who is online

Users browsing this forum: Kirone and 5 guests