Shell

Description:

baShell executes a file.

Platforms:

Windows and Macintosh

Usage:

Result = baShell( Operation, Filename, Args, WorkDir, State )

Arguments:

String, string, string, string, string.
Operation is the action to perform on the file.
Filename is the name of the file the shortcut will point to.
Args is any command line arguments to use.
WorkDir is the working directory to set. Ignored on Macintosh.
State is the state to start the program in. Ignored on Macintosh.

Returns:

Integer.
Returns a number larger than 32 if successful.
Returns an error code. If the return is less than 32 than an error occurred. On Windows, possible return values are:

System was out of memory.

File was not found.

Path was not found.

Sharing or network-protection error.

Library required separate data segments for each task.

There was insufficient memory to start the application.

10 

Windows version was incorrect.

11 

Executable file was invalid. Either it was not a Windows application or there was an error in the .EXE image.

12 

Application was designed for a different operating system.

13 

Application was designed for MS-DOS 4.0.

14 

Type of executable file was unknown.

15 

Attempt was made to load a real-mode application (developed for an earlier version of Windows).

16 

Attempt was made to load a second instance of an executable file containing multiple data segments that were not marked read-only.

19 

Attempt was made to load a compressed executable file. The file must be decompressed before it can be loaded.

20 

Dynamic-link library (DLL) file was invalid. One of the DLLs required to run this application was corrupt.

21 

Application requires 32-bit extensions.

26 

A sharing violation occurred.

27 

The filename association is incomplete or invalid.

29 

The DDE transaction failed.

30 

The DDE transaction could not be completed because other DDE transactions were being processed.

31 

There is no application associated with the given filename

Examples:

Director:
ok = baShell( "open", "c:\windows\notepad.exe", "myfile.txt" , "", "normal" )
ok = baShell( "edit", "myfile.htm" , "", "", "normal" )

Authorware:
ok := baShell( "open", "myfile.doc", "" , "", "normal" )
 

Notes:

On Windows, this function can execute either a document or a program file. If it opens a document file, the Args parameter is ignored. The Operation can be any action that is registered with the document type, most commonly 'open' and 'print'. If the specified action is not registered to the document, the function will return 31. Only the 'open' action works on program files.

On Macintosh, this function can be used to open a document in a specified program, rather than in the default program as baOpenFile does. The Filename must be supplied in Unix format. If there is a space in the file name, then the entire name must be surrounded by single quotation marks. The Args is the document to open and must be a valid existing file name, be in Unix format and use single quotation marks if the name contains a space. You can supply more than one document name, in this case each file name must be surrounded by single quotation marks and separated by a space.

On Macintosh, you can use "system" as an Operation to execute a system function, in which case the Filename is used for the command passed to the system, e.g. baShell( "system", "killall TextEdit", "", "", "" ).
 

See also:

baOpenFile
baPrintFile
baRunProgram