Launching an app with fscommand on Mac OS X

Last week we banged our heads several hours to discover why launching an app with ‘fscommand’ didn’t work on Mac OS X. ‘fscommand’ is an instruction you can issue inside ActionScript code to tell the Flash Player specific instrutions, e.g. to go fullscreen or execute an application. We found [[|things]] all over the forums but nothing really seemed to work. Today I had a bit more of time to explore this and found the details we were missing earlier. Just remember this works only with a created projector inside the player, not in other modes like debug or test.

First, I created a simple Flash application that only contained a MovieClip named ‘button1’. Then I wrote the code for the onRelease event of the MovieClip as follows:

button1.onRelease = function () {
fscommand("exec", "");

Replacing ‘’ for the name of the application you want to launch won’t work. Why?

The exec command runs in the subdirectory ‘fscommand’ only. In other words, if you use the fscommand exec command to call an application, the application must reside in a subdirectory named fscommand. So the folder structure needs to be something like this:

"Any name" main folder/
- fscommand/

Oddly enough, replacing ‘’ for the name of the application you want to launch in the new structure also doesn’t work. Is this a bug?

The workaround seems to be creating an AppleScript that simply calls the application you want to launch. I was a bit disappointed when I found this because I wanted a simple way to do this, not another programming language to learn. But as soon as I realized how easy it is to create such a script I laughed. An explanation follows.

==== Creating the AppleScript ====

Open up the AppleScript editor.

Press ‘Record’ and then open the application you want to launch.

Press ‘Stop’.

Select ‘Save as’ and choose a name for the script but don’t forget that it has to end with ‘.app’.

The applescript must be saved as an application, set to ‘run only’, and with the extension visible.

==== Remarks ====

Be sure to name your programs right so fscommand can execute them. The exec command can contain only the characters A-Z, a-z, 0-9, period ()., and underscore (_).

Keyphrases: Mac Projector Applescript/FScommand problem