Chapter 4: HELPER APPLICATIONS
For a really professional looking result we need to get rid of that
DOS box! Unfortunately there's no way to do this without a special
purpose helper application. Since not everyone has a programmer
in their back pocket, we've done the hard work for you and created
a couple of free utilities you can use to add some polish to your
Flash applications.
The first utility is called INVOKE. It works on all Windows platforms
and banishes the DOS box completely. You call it the same way you
would have used DOSTART.BAT and INVOKE does all the work that START
would have done to open the file you specify.
usage: invoke.exe action filespec
The action argument describes an operation to be
performed on the specified file. If the action you use is not defined
for the select file or folder, INVOKE will fail silently. Case is
not important.
The filespec can be a relative or fully qualified
path to a file, folder and even a URL. If the specified file or
folder can't be found, INVOKE will fail silently. A bad URL will
still cause a browser window to be opened (and stay open). Case
is not important (but might be significant in URLs).
The available actions you can use vary according to the file type.
Some common operations available include open, explore (only for
folders), print, install and edit. You can find out what actions
are supported for files on your system by looking at the File
Types tab under Tools | Folder Options
in Explorer. Below is an example of what you might find if you lookup
up the actions for the PDF file type.


|
The following fscommand will open file.pdf in the default application
for PDF files. If no application is registered to handle PDF file,
or the open action is not supported for PDF files, INVOKE will fail
silently.
fscommand("EXEC",
"invoke.exe" + chr(9) + "open" + chr(9) + "file.pdf")
The following syntax will send file.txt to the currently selected
printer using the default application for TXT files (Notepad on
most systems). This is equivalent to calling notepad.exe /p file.txt
(for text files). If no application is registered to handle the
print action for TXT files, INVOKE will fail silently.
fscommand("EXEC",
"invoke.exe" + chr(9) + "print" + chr(9) + "file.txt")
The following syntax will open a browser window at www.northcode.com.
This is an alternative method to getURL().
fscommand("EXEC",
"invoke.exe" + chr(9) + "open" + chr(9) + "http://www.northcode.com
")
That's fine for opening applications but what about more complicated
tasks that require multiple steps? For that you still need a BAT
file. You already know that when you EXEC a batch file, a DOS command
window is opened and is either fully visible or will be relegated
to the task bar. In either case the effect detracts from the quality
of your presentation. My RUNHIDE utility fixes
this cosmetic problem by hiding the window of the program you are
launching. RUNHIDE allows you to suppress the DOS
box that normally appears when you run a BAT file. Think about that
for a second. With this utility you can launch any BAT file without
a DOS box while other applications that you open from the BAT file
will still appear as they normally would.
The following command will launch hideme.bat but the normal DOS
window will be hidden from view. The BAT file may open other windows
and they will appear normally.
fscommand("EXEC",
"runhide.exe" + chr(9) + "hideme.bat");
You can download INVOKE.exe and RUNHIDE.exe at www.extendingflash.com/utilities.
|