Inserting Macros in SOLIDWORKS Task Add-in Scripts (For SOLIDWORKS PDM Professional only)

You can use macros to modify existing scripts, such as the Convert or Print task scripts, or create your own.

When you insert macros in a script, the task add-in parses them as tokens. At runtime, script values enclosed in < > are replaced with values by the SOLIDWORKS Task Add-in. The values are passed to SOLIDWORKS and run as macros.

Review the Convert and Print scripts to see how < > macros are used. Generally, you can place the macros where the task script is expecting to receive a value.

With < > macros, the code does a find and replace operation. If you use strings, you must include quotes "" around the macros as you normally would when specifying a string value in Visual Basic scripting. If you do not, raw text that is not enclosed properly for the variable type will cause script errors.

Examples of macro assignments of the <Path> macro:
  Code and Result
Variables sPath="<Path>"


Function or sub-routine call GetFileNameFromPath("<Filepath>")