Setting up executable files

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 form, and attempts to execute the line.

This 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 look like this:
    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
    Specify DeletePreviewFiles.
    Executable Name
    Specify DeletePreviewFiles.cmd.
    Executable Type
    Select EXE.

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

  3. Add a Button component.
    This button will be used to run the executable.
  4. In the Component > Properties tab, specify this information:
    Name
    Specify TextEXE.
    Caption
    Specify sTest.
  5. Create an event for the TextEXE button:
    1. In the Component > Events > Primary field, click the ellipses () button.
    2. In the Event Handlers dialog box, click New.
    3. In the Event Handler Properties dialog box, specify this information:
      Event
      Specify RunExe.
      Description
      Optionally, specify the event description.
      Type
      Select Run Background Task.
    4. In the Parameters field, click the ellipses () button.
    5. In the Event Handler Parameters dialog box, specify this information:
      Error Message
      Specify mBackendMessage.
      Success Message
      Specify sSuccess.
    6. Click Type Specific Parameters.
    7. In the Edit Background Task Name and Parms dialog box, specify DeletePreviewFiles as the Task Name.
    8. Click OK.
    9. Verify that RunExe is the primary event for the TestEXE button.
  6. Save the form.
    TaskMan will update ActiveBGTasks and BGTaskHistory for EXE tasks. It is up to the executable file to handle all other database connections.