Tutorial details:
Written by: David Kilbourne
Difficulty Level: intermediate
Requirements: Flash 4 Part 1

Editor's note: This tutorial has been archived because the original source for the required EXE no long exists. We suggest you see the tutorials linked in the "Related Articles" section, at the bottom of this page, as they are more current and support much of the same functionality.

This tutorial was written for use with a program I authored myself DefaultApp.exe Beta . This tutorial is essentially just a copy of the "readme" I wrote.

DefaultApp.exe Beta
for Flash 4 (not tested with Flash 5 but by visiting http://www.flashtools.net/ you can find up to date version of application)

This program is freeware and hence can be distributed wherever and however you like but please, please stop distributing this program once the final is done .... distribute the final instead..

Compatible with:

Windows 95, Windows 98, Windows NT 4.0, Windows 2000, Windows ME,

Launch time:

Estimated 1 second or less on a 2x speed cdrom drive (if a 2x speed can read data at 300 kb/s then you do the math concerning your drive speed)

About this program:

Due to what seems to be a need for this product I am doing a early launch entitled "Beta" I could have the finished version done the day after I write this or sometime next year.. (Who knows when I'll get around to it :)

What's coming in the official release:

  • Small file size I estimate about 30 kb (so far)
  • rowse command line the ability to Browse the cdrom

    Possible additions:

  • Print command for printing from default application
  • Reading the registry for keys and upon not finding one reporting back error message (good for like detecting as a example if Adobe Acrobat is installed :)
  • There some other possible features but my mind is totally blank when writing this :)

    Placing the command line arguments in Flash

    To launch a executable under flash you of course need to go the Action command of the Button and Click the + and choose FS Command and then choose EXEC for standalone player

    Now placing the command line argument is a little tricky but first you must make the argument a Expression.. Click the ABC icon and click Expression

    Now the syntax is a little tricky but I'll try and explain...

    - Here "defaultapp" is the name of the executable
    - & Chr (9) & is telling flash to put a space between the argument (flash doesn't really except real spaces but this line gives flash a real one)
    - and "folder/a.txt" is the command line argument it tells my program to look in a folder called folder and open a.txt in the default viewer (for me it's Windows Notepad)

    The syntax goes like this
    "defaultapp" & Chr (9) & "nameoffileandextension.ext"

    You can basically copy and paste the code above and just change this little part nameoffileandextension.ext to suite your needs..

    If your still confused study Example.fla thoroughly it has working code for opening the a.txt file..

    - Place the application in your root directory or in a root directory where it can launch the files..
    - DefaultApp.exe can open any file registered with the Windows Shell
    - When launching your file never ever specify a location by drive letter only by somefolder/somefile.txt

    Examples of using DefaultApp.exe

    defaultapp sometextfile.txt
    defaultapp somedocfile.doc
    defaultapp somepdf.pdf
    defaultapp somemovie.mov
    defaultapp somemovie.avi
    defaultapp http://www.somewebsite.com/ (of course you really shouldn't need this..)

    Error Messages:

    There are only two programmed error messages
    Error 1 = That you did not specify a file
    Error 2 = That you exceeded a file name of 100 characters

    For Programmers:

    If you'd like to see what is going on it's pretty simple look at these documents on the Shellexecute API put out by Microsoft
    ShellExecute Method
    ShellExcute and Launching Applications
    My program is currently set to OPEN files only.. (That may change later)