logo.
home. utilities. download. about. contact.
   

Macromedia

Northcode

Moock.org

Flashkit

Flashcoders Wiki

Actionscript.org

Ultrashock

Mike Chambers

Flash Magazine

This site is
sponsored by:

www.northcode.com

 

 

 

 

 


Invoke.
Invoke a shell action for a specified file  

There are a surprising number of things you can use the INVOKE utility for. It can open URLs in the users default browser, open Explorer at a specified directory, open and print files in their default applications, open a shortcut, run a program and more. Each new application that is installed can make new actions available for you to use!

usage: invoke.exe action file spec

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 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 filespec can be a relative or fully qualified path to a file, folder and even a URL. It 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).

 

fscommand("EXEC", "invoke.exe" + chr(9) + "open" + chr(9) + "file.pdf"); 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) + "print" + chr(9) + "file.txt"); 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) + "open" + chr(9) + "http://extendingFlash.com"); will open a browser window at extendingFlash.com. This is an alternative method to getURL().

  • Flash MX does not allow spaces in the argument to the EXEC actionScript command. This means that the INVOKE utility can't be called directly from Flash MX.

  • In a batch file the pattern can contain spaces which provides a workaround for Flash 5 limitations and makes it possible to use INVOKE from Flash MX projectors.

  • If you're working with SWF Studio you can use spaces in the pattern argument so you can use INVOKE to affect other windows. If you want to change the z-order of your own window, use the SWF Studio INVOKE fscommand instead.

download.