Create task using COM object or executable

Requires that you know how to work in a program language, such as VB.net.

Definine COM interface

If you want to use the custom task functionality with COM, first create a COM component which is derived from IServiceModules. The file ServiceModuleInterfaceDef.tlb, which defines the COM interface -- IServiceModules, is installed at Program Files Autodesk Inventor [version] Bin. There are five methods defined in the interface:

Note: Reference the file ServiceModuleInterfaceDef.tlb within your project for access to the COM interface.

Task procedure

  1. In the Autodesk Inventor Task Scheduler main menu, click Create Task Custom Task .
  2. In the Custom Task dialog box, enter a name for the new task, and click the <<...>> button near the Task Type list box.
  3. In the Custom Task Type dialog box, click New.
  4. In the Task Type dialog box:

    Task Type: Enter a name for the task.

    ProgramID/Application: Specify the Program ID of a COM object, and enter a name, such as ServiceModule.MigrationManager. Alternatively, specify Application (EXE File) and enter the name of an executable file, such as notepad.exe. Click OK.

    The new custom task type is listed in the Custom Task Type dialog box.

    To edit a task type in the list, select the task and then click Edit. In the Task Type dialog box, enter the changes.

    To delete a task type in the list, click Delete. In the warning message dialog box, click Yes to delete the custom task type. If the task is still in use, a warning message prompts you that it cannot be deleted.

    Click OK.

    Note: If your task was Notepad, the notepad.exe c:\temp\Migration.txt is executed, and c:\temp\Migration.txt is opened in Notepad.
  5. In the Custom Task dialog box:

    Task Type: Select the new task.

    Parameters: Enter parameters. For example, for a notepad.exe, specify the name of the text file to open.

    Task Schedule: Specify a schedule

    or

    select Immediately.

    Time Out: Specify whether to use a time-out threshold., and enter a value.

    Click OK.

If this task is the first you create during the current session, the Authentication dialog box is displayed. Enter your Microsoft Windows log in name and password.

The task is displayed in the task list. You can close the Autodesk Inventor Task Scheduler window. The task runs as scheduled.

Example: Convert IDW to DWG using COM

For this procedure, you build the solution first, and then invoke COM.

  1. In the Task Scheduler main menu, click Create Task Custom Task .
  2. In the Custom Task dialog box, enter a name for the new task, and click the <<...>> button near the Task Type list box.
  3. In the Custom Task Type dialog box, click New.
  4. In the Task Type dialog box:

    Task Type Name: Enter the name ConvertIDW2DWG

    Program ID/Application: Enter ConvertDLL.ConvertManager

    Select Program ID(COM)

    Click OK.

  5. The new custom task type named ConvertIDW2DWG is listed in the Custom Task Type Dialog box. Click OK.
  6. In the Custom Task dialog box:

    Parameters: Enter the .idw file name and the .dwg file name. (Example: E:\Datasets\Version12\part1111.idw|E:\Datasets\Version12\part1111.dwg)

    Note: The format is IDW_FULLPATH_NAME|DWG_FULLPATH_NAME|, where the symbol |is used as a separator.

    Task Schedule: Specify a schedule for the task.

    Time Out: Select Time Out, and in Hr(s), enter 72.

    Click OK

    Note: This format is the way Task Scheduler parses the option parameters when you invoke COM, so you must use the exact formatting.

Example: Convert IDW to DWG using EXE

For this procedure, you build the solution first, and then invoke EXE.

  1. In the Task Scheduler main menu, click Create Task Custom Task.
  2. In the Custom Task dialog box, enter a name for the new task, and click the <<...>> button near the Task Type list box.
  3. In the Custom Task Type dialog box, click New.
  4. In the Task Type dialog box:

    Task Type Name: Enter the name ConvertIDW2DWGExe

    Program ID/Application: Enter ConvertIDWToDWG\debug\ConvertIDWToDWG.exe

    Select Application (EXE File).

    Click OK.

  5. The new custom task type named ConvertIDW2DWGExe is listed in the Custom Task Type Dialog box. Click OK.
  6. In the Custom Task dialog box:

    Parameters: Enter the .idw file name and the .dwg file name. (Example: E:\Datasets\Version12\part1111.idw;E:\Datasets\Version12\part1111.dwg)

    Note: The format is IDW_FULLPATH_NAME;DWG_FULLPATH_NAME;, where the semicolon is used as a separator.

    Task Schedule: Specify a schedule for the task.

    Time Out: Select Time Out, and in Hr(s), enter 72.

    Click OK

    Note: It is how the .exe parses the option parameters. As you can see in the code, the parameters are parsed and transformed to the parameters of Task Scheduler.