company logo

CTX_Base :: ExecuteShell - Execute action according to file type

The function executes an action (prgnames) specific for a given file type, which is associated with the file extension. Typically, the action (prgnames) is "Open", which will open the file according to its extension type.

The function executes the file passed in (prgnames) according to the file type, which is associated with the file extension. Usually, the action passed to the shell command in oper_string is open, which will open the file according to its extension type. One may, however, pass any other action name and parameters, which are supported by the program called for the file extension. Typical actions are edit, print, browse and find.

Under MS Windows, the ShellExecute() function will be called, which refers to file associations defined in the system. Under Linux systems, file associations have to be defined in an option section FileAssociations, which has to be provided in the configuration file or via database option settings. The structure of this section is as follows:

FileAssociations

    extension default call

        open call for open action

        browse call for browse action

        edit call for edit action

        print call for print action

        find call for find action

        action call for any other action

    extension (section for next extension ...)

    ...

Besides default actions, any number of application specific extensions may be defined. The call string may contain the following placeholders:

  • %f - replaced by complete file path as passed to the function
  • %p - replaced by parameter(s) passed to the function
  • %a - replaced by action name

The call string may also contain any number of option settings as %option_path%., which are replaced by appropriate option valued before calling the application.

When no action has been passed to the function, the default call as being defined for the extension option is used. The default call is also used, when passing an unknown action. When passing an unknown action and not defining a default call, the function throws an exception.

When the context handle does not refer to a valid context instance the function throws an exception.

Return value:  Success ( logical  )

Implementation details

logical CTX_Base  :: ExecuteShell ( NString &oper_string, NPath &file_names, NString &parm1_w=NString::Null(), logical chk_opt=NO )
  • oper_string - oper_string - Title unknown
  • file_names - File name
  • parm1_w - - internal feature (not documented) Default: NString::Null()
  • chk_opt - Check option

    The option forces the function to check the property handle before running executing the function. You can pass NO to avoid unnecessary checking.

    Default: NO