Running executables

Note: This topic applies to only on-premises environments.

TaskMan can also be used to execute a command string as an operating system command shell. TaskMan takes the executable name from a Background Task Definitions record, appends the parameters from the TaskMan form, and attempts to execute the line.

The following example shows the steps to set up an executable that runs through TaskMan from a form:

  1. Create a file called DeletePreviewFiles.cmd in your TaskMan folder. The text of this file should be as follows:

    FOR /D %%D IN ("taskman_dir\Report\OutputFiles\*") DO del /Q "%%D\Preview\*"

    where taskman_dir is replaced by the name of your TaskMan folder.

  2. Set up a Background Task Definition record:
    • Task Name: DeletePreviewFiles
    • Executable Name: DeletePreviewFiles.cmd
    • Executable Type: EXE

    If the executable is not in the TaskMan folder, include the path to the executable in the Executable Name field (for example, C:\Program Files\MyExecutable.exe).

  3. Add a button to a form, giving it the name TextEXE and the caption sTest.

    This button will be used to run the executable.

  4. On the Components property sheet for the button, create an event named RunExe:
    1. Click the Events button (appears as a yellow lightning bolt on the component properties sheet).
    2. Click Primary, and then click the associated ellipses (...) button.
    3. In the Event Handlers dialog, click New.
    4. In the Event Handler Properties dialog, set these values:
      Event
      Specify RunEXE.
      Description
      Enter an optional description or leave blank.
      Type
      Run Background Task.
    5. For the parameters, click Parms, and then click the ellipses (...) button. In the Event Handler Parms dialog, specify this information:
      Error Message
      Specify mBackendMessage.
      Success Message
      Specify sSuccess.
    6. Click Type Specific Parameters. In the Edit Background Task Name and Parms dialog, specify this information:
      Task Name
      Specify DeletePreviewFiles.
    7. Click OK repeatedly until you return to the form.
    8. Verify that RunExe is the primary event for the TestEXE button.
    9. Save the form.

      When you click the button, this batch file will delete all the Print Preview intermediate files.