opening external documents using batch files (Director/Flash, Win only) issue: Director as well as Flash offer an option to open external applications when played in a projector. the problem in Flash is that it allows only to target applications (if you know where they are), not documents. Director allows you to open a specific document with a certain application, but you have again the problem that you usually don't know, where the user has installed Acrobat, Word, Excel or whatever document you want to open. Windows offers a simple workaround for this problem - you can use a bat file, which is in fact a little DOS program. All you have to do is to open e.g. Notepad, open a new document and type a single line: the command "start" followed by the path of the file you want to open. if you put the bat file into the same folder as your document, the name of the document is sufficient as a relative path. lets say you want to open the file MyDocument.pdf. the text would be: start MyDocument.pdf then you save the file giving it a .bat extention, let's say we call it launch.bat. that's it for the beginning. if you make a doubleclick onto the bat file you will see it will launch the pdf file with acrobat just as if you would have made a doubleclick onto the pdf file itself. so far it has the disadvantage that a DOS window opens and stays open. this can be changed by making a rightmousclick onto the bat file, select properties, select the program tab and change the run setting to minimized and tick close on exit. you will now get a pif file (looks like a MSDos shortcut) which you have to put into the same folder as the bat file. launching from Flash: in Flash you can use FScommand to launch the bat file. just select the FScommand action wherever you need it, put Exec into the command field and the path to the bat file into the argument field. again - the simpliest way is to keep everything in the same folder, then the name of the bat file is enough. NOTE: this is as well a method to open HTML files with the users default browser. you might have experienced, that Flash 4 will open a browser if you use a simple GetURL action - but be aware that this is not a supported feature of Flash (you will not find it in the manual). it has the flaw that on Windows it will always try to launch Internet Explorer, regardless if it is installed or not. for a more sophisticated way
of achieving this have a look at
launching from Director: simply use the open command and target the bat file with it.
|