Go Premium for a chance to win a PS4. Enter to Win

  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 298
  • Last Modified:

How do you execute a specific file (in my case .ppt) from a button in a Flash Projector file and have it open in the correct application?

I have built a presentation in Flash that is delivered via CD as a Projector File. My client has requested a button that would open a PowerPoint deck that would also be on the CD in its own directory. Is this possible? I am on a MAC but this would primarily be used on PC's. However, a solution for both would be much appreciated.
  • 2
1 Solution
I can't help you with a Mac, but the following link is a tried and tested method on a PC

Using fscommand to launch is the way... let me tell u how to do that here both in mac and windows using apple scripts and Batch commands

to get fscommand exec, to work in mac, you need to:

Ctrl click, "myflashprojector.app" and click "Show Package Contents" copy the fscommand folder into MacOS (its a subfolder of "Contents") and then it will work... This is because its a bug found in FlashCS3...

putting all the .pdf's or .rtf's that you want to open through the flash, into the fscommand folder, well you probably already know that this would double the size of the disk, And thats true, but with a little work you will only need the .bat's and the applescripts to be in the fscommand folder

so i'm going to give you some snippets of .bat codes and apple scripting that can open up a file no matter where it is (well almost)

Lets start with the .bat file (hope u know to work with BATCH)

@echo off

start ../"Pdf Folder"/"my Pdf".pdf


Now what this code does is, it goes one folder up, and into another folder,and opens the pdf, and once started the command prompt will pop up, but there won't be any text in it, and once the file is open the command prompt will close. something else important to know is, files or folders containing a SPACE
will need to have qoutation marks or it will tell you it cant find the file.

If you dont want to have the command prompt come up at all, there is a proxy .exe floating around you can google it and find out how to use it. (refer here: http://www.northcode.com/blog.php/2007/08/07/Conquering-FSCommand-EXEC-Part-1-Proxy)

In batch here is one more thing that need to be taken into consderation: refer here: http://www.northcode.com/blog.php/2008/07/28/Fixing-the-Windows-Start-Command-in-Vista
This is for Proxy with MS Vista

Now for the applescript

tell application "Finder"


open document file "file.pdf" of folder "Pdf folder" of disk "name of disk here"

end tell

Well thats it, i hope this helps people.
Remember that fscommand will only work in the Flash projector file (not from the .fla or within html). Create a batch file (filename.bat, test.bat etc...) using a text editor like Notepad in a directory called "fscommand" in the same location as the Flash projector. Add the following for a PC:

@ echo off
start <file to load> (i.e. U:\testing.ppt, or C:\excelFiles\test.xls etc..)

Save the .bat file.

Next, use a button or a function to call the following in actionscript:

fscommand ("exec", "test.bat");

omit any directory structure here since Flash ALWAYS assumes that this file is in a folder called "fscommand" located where the Flash projector is located.

Publish the projector file and run to test. You should see a quick flash of the DOS window (PC) and then your file should load in it's appropriate application.
And if you want to avoid that (IMO, ugly) DOS box appearance, use the 'proxy.exe' file from Northcode (the original link I gave above).

Featured Post

Free Tool: SSL Checker

Scans your site and returns information about your SSL implementation and certificate. Helpful for debugging and validating your SSL configuration.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now