FSCommand EXEC is Broken in Flash CS3
 Posted on Tue Aug 14 2007 in Flash by Tim

For years Flash has allowed any valid Windows executable to be launched via fscommand EXEC from a Flash projector. That has come to an end with Flash CS3. Flash 9 projectors fail to launch BAT files on Windows 2000, XP and Vista but it still works on Windows 98 and ME! This is major inconvenience but it's not the end of the world. First I'll show you why it's broken, then I'll show you how you can still launch BAT files from your Flash projectors, with a little help...

On NT based systems (2000, XP and Vista) Flash 9 projectors now create child process with a UNC path instead of a simple DOS path as all previous versions of the standalone player have done. The resulting error when you launch a BAT file appears for a fraction of a second but I managed to capture it.



Why is Flash trying to launch CMD.EXE when we asked it to start a BAT file? CMD.EXE is the Windows command processor that handles BAT files. When ever you run a BAT file Windows starts a copy of CMD.EXE to handle it. It's CMD.EXE that's responsible for the ugly DOS box you see when running BAT files.

Because CMD.EXE doesn't understand UNC paths it can't set the current directory and so it defaults to the Windows directory. Since your BAT file is not in the Windows directory CMD.EXE can't find it to process it and the call to EXEC fails.

The same fate may befall any application that uses the output of GetModuleFileName, GetCurrentDirectory, or attempts to parse the command line without accounting for the possible use of UNC paths. I created a simple application display it's own command line and the current directory to demonstrate the difference between Flash CS3 and previous versions.

When called from a Flash 8 projector:


When called from a Flash CS3 projector:


This doesn't mean that all applications will automatically fail, but if they depend on the current directory and they don't accept UNC paths, then they may not work as expected.

The reason you can still run BAT files on Windows 98 and ME is because they use a different command processor (command.com) and Flash CS3 doesn't generate UNC path on these systems. So for these older Windows systems you can still EXEC a BAT file.

Unless Adobe reverts to passing DOS paths instead of UNC path there is only one feasible solution to using BAT files with Flash. Instead of launching the BAT file directly we need a helper application that can launch the BAT files for us instead of depending on the command processor. Luckily a FREE solution to this problem already exists.

A few years ago I created a utility called proxy to run BAT files and hide the ugly DOS box that appears. It makes your projectors look more professional and gets around the problem Flash CS3 has with BAT files. The proxy utility now has a permanent home on this blog.

Conquering FSCommand EXEC Part 1 : Proxy explains how to use proxy and contains a link to download proxy.exe.

Comments

your the best!! thank you so much
Posted by marcos on 11 Sep 2007 at 2:57pm
at last after many hours of browsing :)
Posted by polyetilen on 30 Oct 2007 at 6:48pm
Thanks Dude....
Posted by Priyanath on 2 Nov 2007 at 3:05am
Last night you save my life

Thank yoouuuuuu a lot !!!

Gracias campeón.
Posted by Sergio on 30 Nov 2007 at 7:59am
THANK YOU!!!
THANK YOU!!!
THANK YOU!!!

I was going crasy...


Posted by Alejandro on 3 Dec 2007 at 8:04pm
You're the best.
No comment.
Just applause.

Thanx a lot, you save my life.

ST3M
Posted by ST3M on 7 Dec 2007 at 1:39pm
Thank you, not only for taking the time to solve the problem, but also to explain what has happened on Adobe's end. I've used proxy.exe prior to CS3 for convenience issues. Now I'm so glad that it has a permanenet home here for solving such a serious issue.

Cheers,

-MT
Posted by MTippin on 14 Jan 2008 at 10:21pm
u've saved me
Posted by naveed on 11 Feb 2008 at 12:59pm
Thank you, very useful information.
Posted by cosmoz on 15 Feb 2008 at 5:46am
Yes, you are completely awesome!!

I've been using the older version and this update was super easy to implement!

Thank you for sharing and educating me!
Posted by Giovanna Ghio on 23 Apr 2008 at 5:02pm
great thank you from Italy - Rimini
By Sara
Posted by Sara on 30 May 2008 at 5:58am
Thanks. That sorted my PC .exe.

This may be the same problem that was causing my projector not to work on Macs. ie it could not find the applescript app to run. The solution that I found was to save the fla from CS3 to Flash 8 and then re-create the projector. Then it all works fine.
Posted by andy on 15 Jun 2008 at 2:04pm
CS3 broke fscommand for Macs as well. I'm not sure exactly how, but I suspect that it was something similar. Going back to Flash 8 would definitely get around the problem if that's an option for you.
Posted by Tim on 16 Jun 2008 at 12:56pm
Leave a Comment

Add a comment by filling out the form below. All comments will be reviewed before they appear.

name:

email:

website:

comment:


← Back
 

copyright © 2000-2007 Northcode Inc  ·  all rights reserved  ·  contact us  ·  report piracy  ·  privacy policy