Files
pdm/documentation/api_extracted/StandardTaskAddIn.htm

187 lines
15 KiB
HTML

<html>
<head>
<title>Standard Task Add-in</title>
<meta name=MS-HKWD content="Tasks">
<meta name=MS-HKWD content="Add-ins, tasks">
<meta http-equiv="Content-Language" content="en-us">
<meta http-equiv="Content-Type" content="text/html; charset=windows-1252">
<link rel="stylesheet" type="text/css" href="ApiHelp.css">
<style>
</style>
</head>
<body>
<h1><span style="font-weight: normal; font-size: 7.5pt;">SOLIDWORKS PDM Professional API Help</span></h1>
<h1>Standard Task Add-in</h1>
<div class="Section1">
<span style="font-family: Verdana; font-size: 8pt">You can write your own
<a style="color: blue; text-decoration: underline; text-underline: single" href="Tasks.htm"> task</a>
add-in using SOLIDWORKS PDM Professional API's methods and
interfaces. Doing so gives you full control over what the task should do. </span>
<p><span style="font-family: Verdana; font-size: 8pt">However, if
you simply want a task to open files in SOLIDWORKS and run VBScripts on
them, then you can reuse the standard task add-in shipped with SOLIDWORKS PDM
Professional.<br>
<br>
The standard task add-in provides two tasks: </span></p>
<ul style="margin-bottom: 0in">
<li><span style="font-family: Verdana; font-size: 8pt">Printing files
using SOLIDWORKS. </span></li>
<li><span style="font-family: Verdana; font-size: 8pt">Converting
SOLIDWORKS files to other file formats. </span></li>
</ul>
<p><span style="font-family: Verdana">Additionally you can modify the
standard task add-in to execute any script.</span></p>
<ol style="font-family: Verdana; font-size: 8pt">
<li><span style="font-family: Verdana; font-size: 8pt">Make sure that
the add-in, SWTaskAddIn, is installed in the vault.</span><font face="Verdana" style="font-size: 8pt">
</font></li>
<li><span style="font-family: Verdana; font-size: 8pt">Start the
Administration tool, right-click <b>Tasks</b> in the tree, and select <b>
New Task</b>.</span><font face="Verdana" style="font-size: 8pt"> </font>
</li>
<li><span style="font-family: Verdana; font-size: 8pt">Select the
SWTaskAddIn add-in in the first page of the dialog box</span><font face="Verdana" style="font-size: 8pt">.
</font></li>
<li><span style="font-family: Verdana; font-size: 8pt">Go to the Script
page and edit the code in the main function. <br>
The <b>Insert Macro</b> button makes it possible to insert macros that
will be replaced with data from SOLIDWORKS PDM Professional when the
script is executed. </span>
<span style="font-family: Verdana; font-size: 8pt" lang="SV">Read more
about macros in the following section.</span><font face="Verdana" style="font-size: 8pt">
</font></li>
<li><span style="font-family: Verdana; font-size: 8pt">Set all other
tasks settings, such as computer on which to execute, notifications,
etc.</span><font face="Verdana" style="font-size: 8pt"> </font></li>
</ol>
<h2 style="MARGIN-BOTTOM: 12pt"><strong><span style="font-family: Verdana">
Macros</span></strong></h2>
<p style="MARGIN-BOTTOM: 12pt"><font face="Verdana">The macros in the Insert
Macro menu work inconsistently. Keep in mind:</font></div>
<table style="border-collapse: collapse; border: medium none; margin-left: -0.75pt" class="MsoNormalTable" border="1" cellSpacing="0" cellPadding="0">
<tr style="height: 14.3pt">
<td style="width: 2.5in; height: 14.3pt; border: 1.5pt solid white; padding-left: 3.5pt; padding-right: 3.5pt; padding-top: 0in; padding-bottom: 0in; background: #e0e0e0" vAlign="top" width="240">
<p class="MsoNormal"><b>
<span style="font-size: 8pt; font-family: Verdana">Menu Option</span></b></td>
<td style="width: 2.5in; height: 14.3pt; border-left: medium none; border-right: 1.5pt solid white; border-top: 1.5pt solid white; border-bottom: 1.5pt solid white; padding-left: 3.5pt; padding-right: 3.5pt; padding-top: 0in; padding-bottom: 0in; background: #e0e0e0" vAlign="top" width="240">
<p class="MsoNormal"><b>
<span style="font-size: 8pt; font-family: Verdana">Macro</span></b></td>
<td style="width: 675pt; height: 14.3pt; border-left: medium none; border-right: 1.5pt solid white; border-top: 1.5pt solid white; border-bottom: 1.5pt solid white; padding-left: 3.5pt; padding-right: 3.5pt; padding-top: 0in; padding-bottom: 0in; background: #e0e0e0" vAlign="top" width="900">
<p class="MsoNormal"><b>
<span style="font-size: 8pt; font-family: Verdana">Note</span></b></td>
</tr>
<tr style="height: 16.15pt">
<td style="width: 2.5in; height: 16.15pt; border-left: 1.5pt solid white; border-right: 1.5pt solid white; border-top: medium none; border-bottom: 1.5pt solid white; padding-left: 3.5pt; padding-right: 3.5pt; padding-top: 0in; padding-bottom: 0in; background: #f3f3f3" vAlign="top" width="240">
<p class="MsoNormal"><span style="font-size: 8pt; font-family: Verdana">
Source File Name</span></td>
<td style="width: 2.5in; height: 16.15pt; border-left: medium none; border-right: 1.5pt solid white; border-top: medium none; border-bottom: 1.5pt solid white; padding-left: 3.5pt; padding-right: 3.5pt; padding-top: 0in; padding-bottom: 0in; background: #f3f3f3" vAlign="top" width="240">
<p class="MsoNormal"><span style="font-size: 8pt; font-family: Verdana">
&lt;Filename&gt;</span></td>
<td style="width: 675pt; height: 16.15pt; border-left: medium none; border-right: 1.5pt solid white; border-top: medium none; border-bottom: 1.5pt solid white; padding-left: 3.5pt; padding-right: 3.5pt; padding-top: 0in; padding-bottom: 0in; background: #f3f3f3" vAlign="top" width="900">
<p class="MsoNormal"><span style="font-size: 8pt; font-family: Verdana">
This option is added as the literal string &quot;&lt;Filename&gt;&quot; to the script.
The script has to scan for the string and replace it with the real file
name.</span></td>
</tr>
<tr style="height: 16.15pt">
<td style="width: 2.5in; height: 16.15pt; border-left: 1.5pt solid white; border-right: 1.5pt solid white; border-top: medium none; border-bottom: 1.5pt solid white; padding-left: 3.5pt; padding-right: 3.5pt; padding-top: 0in; padding-bottom: 0in; background: #f3f3f3" vAlign="top" width="240">
<p class="MsoNormal"><span style="font-size: 8pt; font-family: Verdana">
Source File Extension</span></td>
<td style="width: 2.5in; height: 16.15pt; border-left: medium none; border-right: 1.5pt solid white; border-top: medium none; border-bottom: 1.5pt solid white; padding-left: 3.5pt; padding-right: 3.5pt; padding-top: 0in; padding-bottom: 0in; background: #f3f3f3" vAlign="top" width="240">
<p class="MsoNormal"><span style="font-size: 8pt; font-family: Verdana">
&lt;Extension&gt;</span></td>
<td style="width: 675pt; height: 16.15pt; border-left: medium none; border-right: 1.5pt solid white; border-top: medium none; border-bottom: 1.5pt solid white; padding-left: 3.5pt; padding-right: 3.5pt; padding-top: 0in; padding-bottom: 0in; background: #f3f3f3" vAlign="top" width="900">
<p class="MsoNormal"><span style="font-size: 8pt; font-family: Verdana">
This option works like &lt;Filename&gt; in the sense that the macro is not
resolved.</span></td>
</tr>
<tr style="height: 16.15pt">
<td style="width: 2.5in; height: 16.15pt; border-left: 1.5pt solid white; border-right: 1.5pt solid white; border-top: medium none; border-bottom: 1.5pt solid white; padding-left: 3.5pt; padding-right: 3.5pt; padding-top: 0in; padding-bottom: 0in; background: #f3f3f3" vAlign="top" width="240">
<p class="MsoNormal"><span style="font-size: 8pt; font-family: Verdana">
Configuration Name</span></td>
<td style="width: 2.5in; height: 16.15pt; border-left: medium none; border-right: 1.5pt solid white; border-top: medium none; border-bottom: 1.5pt solid white; padding-left: 3.5pt; padding-right: 3.5pt; padding-top: 0in; padding-bottom: 0in; background: #f3f3f3" vAlign="top" width="240">
<p class="MsoNormal"><span style="font-size: 8pt; font-family: Verdana">
&lt;Configuration&gt;</span></td>
<td style="width: 675pt; height: 16.15pt; border-left: medium none; border-right: 1.5pt solid white; border-top: medium none; border-bottom: 1.5pt solid white; padding-left: 3.5pt; padding-right: 3.5pt; padding-top: 0in; padding-bottom: 0in; background: #f3f3f3" vAlign="top" width="900">
<p class="MsoNormal"><span style="font-size: 8pt; font-family: Verdana">
This option works like &lt;Filename&gt; in the sense that the macro is not
resolved.</span></td>
</tr>
<tr style="height: 16.15pt">
<td style="width: 2.5in; height: 16.15pt; border-left: 1.5pt solid white; border-right: 1.5pt solid white; border-top: medium none; border-bottom: 1.5pt solid white; padding-left: 3.5pt; padding-right: 3.5pt; padding-top: 0in; padding-bottom: 0in; background: #f3f3f3" vAlign="top" width="240">
<p class="MsoNormal"><span style="font-size: 8pt; font-family: Verdana">
Source Folder Path</span></td>
<td style="width: 2.5in; height: 16.15pt; border-left: medium none; border-right: 1.5pt solid white; border-top: medium none; border-bottom: 1.5pt solid white; padding-left: 3.5pt; padding-right: 3.5pt; padding-top: 0in; padding-bottom: 0in; background: #f3f3f3" vAlign="top" width="240">
<p class="MsoNormal"><span style="font-size: 8pt; font-family: Verdana">
&lt;Path&gt;</span></td>
<td style="width: 675pt; height: 16.15pt; border-left: medium none; border-right: 1.5pt solid white; border-top: medium none; border-bottom: 1.5pt solid white; padding-left: 3.5pt; padding-right: 3.5pt; padding-top: 0in; padding-bottom: 0in; background: #f3f3f3" vAlign="top" width="900">
<p class="MsoNormal"><font face="Verdana" style="font-size: 8pt">This
macro will be replaced with the file system path to the parent folder of
the source file. Add double quotes around &quot;&lt;Path&gt;&quot; to use it as a
string. Example: </font><span style="font-family: Arial"><strong>
<span style="font-size: 8pt; font-family: Verdana">C:\MyVault\Drawings\</span></strong></span></td>
</tr>
<tr style="height: 16.15pt">
<td style="width: 2.5in; height: 16.15pt; border-left: 1.5pt solid white; border-right: 1.5pt solid white; border-top: medium none; border-bottom: 1.5pt solid white; padding-left: 3.5pt; padding-right: 3.5pt; padding-top: 0in; padding-bottom: 0in; background: #f3f3f3" vAlign="top" width="240">
<p class="MsoNormal"><span style="font-size: 8pt; font-family: Verdana">
Vault Root Folder Path</span></td>
<td style="width: 2.5in; height: 16.15pt; border-left: medium none; border-right: 1.5pt solid white; border-top: medium none; border-bottom: 1.5pt solid white; padding-left: 3.5pt; padding-right: 3.5pt; padding-top: 0in; padding-bottom: 0in; background: #f3f3f3" vAlign="top" width="240">
<p class="MsoNormal"><span style="font-size: 8pt; font-family: Verdana">
&lt;VaultPath&gt;</span></td>
<td style="width: 675pt; height: 16.15pt; border-left: medium none; border-right: 1.5pt solid white; border-top: medium none; border-bottom: 1.5pt solid white; padding-left: 3.5pt; padding-right: 3.5pt; padding-top: 0in; padding-bottom: 0in; background: #f3f3f3" vAlign="top" width="900">
<p class="MsoNormal"><font face="Verdana" style="font-size: 8pt">
Resolves to the root folder of the vault. For instance: </font>
<span style="font-family: Arial"><strong>
<span style="font-size: 8pt; font-family: Verdana">C:\MyVault\</span></strong></span></td>
</tr>
<tr style="height: 16.15pt">
<td style="width: 2.5in; height: 16.15pt; border-left: 1.5pt solid white; border-right: 1.5pt solid white; border-top: medium none; border-bottom: 1.5pt solid white; padding-left: 3.5pt; padding-right: 3.5pt; padding-top: 0in; padding-bottom: 0in; background: #f3f3f3" vAlign="top" width="240">
<p class="MsoNormal"><span style="font-family: Verdana">
<span style="font-size: 8pt">Task Instance GUID</span></span></td>
<td style="width: 2.5in; height: 16.15pt; border-left: medium none; border-right: 1.5pt solid white; border-top: medium none; border-bottom: 1.5pt solid white; padding-left: 3.5pt; padding-right: 3.5pt; padding-top: 0in; padding-bottom: 0in; background: #f3f3f3" vAlign="top" width="240">
<p class="MsoNormal"><span style="font-size: 8pt; font-family: Verdana">
&lt;TaskInstanceGuid&gt;</span></td>
<td style="width: 675pt; height: 16.15pt; border-left: medium none; border-right: 1.5pt solid white; border-top: medium none; border-bottom: 1.5pt solid white; padding-left: 3.5pt; padding-right: 3.5pt; padding-top: 0in; padding-bottom: 0in; background: #f3f3f3" vAlign="top" width="900">
<p class="MsoNormal"><span style="font-size: 8pt; font-family: Verdana">
A GUID (Globally Unique Identifier) that identifies the task instance.</span></td>
</tr>
<tr style="height: 16.15pt">
<td style="width: 2.5in; height: 16.15pt; border-left: 1.5pt solid white; border-right: 1.5pt solid white; border-top: medium none; border-bottom: 1.5pt solid white; padding-left: 3.5pt; padding-right: 3.5pt; padding-top: 0in; padding-bottom: 0in; background: #f3f3f3" vAlign="top" width="240">
<p class="MsoNormal"><span style="font-size: 8pt; font-family: Verdana">
Source File Path</span></td>
<td style="width: 2.5in; height: 16.15pt; border-left: medium none; border-right: 1.5pt solid white; border-top: medium none; border-bottom: 1.5pt solid white; padding-left: 3.5pt; padding-right: 3.5pt; padding-top: 0in; padding-bottom: 0in; background: #f3f3f3" vAlign="top" width="240">
<p class="MsoNormal"><span style="font-size: 8pt; font-family: Verdana">
&lt;Filepath&gt;</span></td>
<td style="width: 675pt; height: 16.15pt; border-left: medium none; border-right: 1.5pt solid white; border-top: medium none; border-bottom: 1.5pt solid white; padding-left: 3.5pt; padding-right: 3.5pt; padding-top: 0in; padding-bottom: 0in; background: #f3f3f3" vAlign="top" width="900">
<p class="MsoNormal"><font face="Verdana" style="font-size: 8pt">
Resolves to the full path to the source file. Example: </font>
<span style="font-family: Arial"><strong>
<span style="font-family: Verdana"><span style="font-size: 8pt">C:\MyVault\Drawings\Part.sldprt</span></span></strong></span></td>
</tr>
</table>
<div class="Section1">
<p style="margin-bottom: 12pt"><span style="font-family: Verdana">You can
create an input card using the card editor to provide a user interface when
the task is launched. The data entered in the card can then be used in the
script. Refer to a card variable value in the script by enclosing it with {
}, for example {Description}, to insert a value from variable, Description.<br>
<br>
It is a good idea to have a look at the scripts for printing and converting,
which are shipped with SOLIDWORKS PDM Professional, for hints on how to write
scripts. The SOLIDWORKS PDM Professional Help contains additional information
about the Administration tool and using the standard task add-in.</span></div>
<h2 style="margin-bottom: 12pt"><span style="font-family: Verdana">See Also</span></h2>
<p style="margin-bottom: 12pt"><a href="TaskSample.htm">Task Add-in Sample</a></p>
<p style="margin-bottom: 12pt"><a href="TaskSample_CSharp.htm">Task Add-in
Sample (C#)</a></p>
<p style="margin-bottom: 12pt">&nbsp;</p>
</body>
</html>