Omnis Technical Note TNWE0017 December 2007

FormFile operation parameters

For Omnis Studio 4
By Omnis Engineering

The FormFile component is a remote form component and allows various file operations to be performed on a client computer via the Omnis Web Client. It contains a number of events and methods including the $osoperation() method which performs the specified operation on the file, depending on the type of application associated with the file: such operations include Open, Edit or Print. The method is supported on Win32 and OS X only (not Linux) and must be executed on the client (client execution must be set to true for the method). The full method and its parameters are:

$osoperation(cPath,cOperation,bCreateProcess)

where cPath is the name and path of the file, cOperation is the application dependent operation, and bCreateProcess specifies whether the ShellExecute or FindExecutable Windows 32 API call is executed against the file (this final parameter is ignored on OS X).

On Windows:

1. With bCreateProcess = FALSE

The verb specified in cOperation can be any operation registered for the type of the file. Therefore "open" is always supported, and "edit" and "print" may be supported, but other file-specific operations may be available for the type of file. The operation is the verb string passed to the ShellExecute API, so you can look at the Win32 docs on ShellExecute for more information. The function uses ShellExecute to open the application associated with the file identified by the path, to carry out the operation.

2. When bCreateProcess = TRUE

If the application associated with the file is a DLL, the $osoperation() method reverts to the bCreateProcess = FALSE case. Otherwise, FormFile calls the FindExecutable Win32 API to get the application associated with the file specified in the path.

If necessary, FormFile starts the process with the file path as an argument; if a process previously created by FormFile (since FormFile was loaded) still exists, FormFile sends a WM_DROPFILES message to the process - this makes the process behave as it does when a file is dropped on it.

On OS X:

The verb specified in cOperation can be "open", "edit" or "print", and the function uses OS X Launch Services to open the application associated with the file identified by the path, to carry out that operation.

Remember, the bCreateProcess parameter is ignored on OS X.