Executing JSFL from the Command Line on OS X

I am working on an OS X version of my FlashCommand command line compiler, and I ran into a problem of how to tell Flash to run a JSFL file from the command line. Gary Grossman came to the rescue with the answer.

You have to use AppleScript to tell Flash to load the file. Here is an example:

osascript -e ‘tell application “Flash” to open alias “Mac OS X:tmp:myTestFile.jsfl”‘

If you are calling this from a script that uses Unix file paths, then you can use the following command:

osascript -e ‘tell application “Flash” to open posix file “/tmp/myTestFile.jsfl”‘

This will open Flash and have it execute the specified JSFL file.

3 Responses to Executing JSFL from the Command Line on OS X

  1. Hi, Mike.MacOS X support “open” command(/usr/bin/open).open myTestFile.jsfloropen -a “/Applications/Macromedia Flash MX 2004/Flash MX 2004” myTestFile.jsfl

  2. Mike Bedar says:

    I barely know what I am doing in the terminal, but i figured out how to get this to work on a folder of FLA’s.First, you need to be running bash. If you are not, open the Terminal preferences and change the shell to “/bin/bash”.Next, “cd” to the directory that contains your FLA’s. This script will search subfolders as well.Last, the command to apply the flashcommand function to all FLA files in the current directory.for file in `find . -type f -name “*.fla”`; do flashcommand -pv -s $file ${file%%fla};doneThis will publish EVERY Fla it finds, so it is very important to make sure you are in the correct directory.The only problem is that it does not close the Fla’s as it runs through them.

  3. Thomas Chen says:

    Hi Mike,I have to export fla to PNG sequence (.png) and QuickTime movie. there are 10+ fla files have to convert everyday. I know how to do it through FLASH 8.Can I use flashcommand or JSFL to implement it?I use AppleScript and I work in MAC OS X environment.IF possible, can you give me a simple example about how to do it.Thanks in advance,