Top Banner
PDMWorks Enterprise Dispatch Guide
36
Welcome message from author
This document is posted to help you gain knowledge. Please leave a comment to let me know what you think about it! Share it to your friends and learn new things together.
Transcript
Page 1: Dispatch Guide

PDMWorks Enterprise Dispatch Guide

Page 2: Dispatch Guide

© 1995-2006, SolidWorks Corporation300 Baker AvenueConcord, Massachusetts 01742 USAAll Rights ReservedU.S. Patents 5,815,154; 6,219,049; 6,219,055; 6,603,486; 6,611,725; 6,844,877; 6,898,560; 6,906,712 and certain other foreign patents, including EP 1,116,190 and JP 3,517,643. U.S. and foreign patents pending.SolidWorks Corporation is a Dassault Systemes S.A. (Nasdaq:DASTY) company.The information and the software discussed in this document are subject to change without notice and should not be considered commitments by SolidWorks Corporation.No material may be reproduced or transmitted in any form or by any means, electronic or mechanical, for any purpose without the express written permission of SolidWorks Corporation.The software discussed in this document is furnished under a license and may be used or copied only in accordance with the terms of this license. All warranties given by SolidWorks Corporation as to the software and documentation are set forth in the SolidWorks Corporation License and Subscription Service Agreement, and nothing stated in, or implied by, this document or its contents shall be considered or deemed a modification or amendment of such warranties.SolidWorks, PDMWorks, 3D PartStream.NET, 3D ContentCentral, eDrawings, and the eDrawings logo are registered trademarks of SolidWorks Corporation, and FeatureManager is a jointly owned registered trademark of SolidWorks Corporation.SolidWorks 2007 is a product name of SolidWorks Corporation.COSMOSXpress, DWGeditor, DWGgateway, Feature Palette, PhotoWorks, and XchangeWorks are trademarks of SolidWorks Corporation.COSMOS and COSMOSWorks are registered trademarks, and COSMOSMotion and COSMOSFloWorks are trademarks of Structural Research & Analysis Corporation.FeatureWorks is a registered trademark of Geometric Software Solutions Co. Limited.ACIS is a registered trademark of Spatial Corporation.GLOBEtrotter and FLEXlm are registered trademarks of Globetrotter Software, Inc.Other brand or product names are trademarks or registered trademarks of their respective holders.COMMERCIAL COMPUTER SOFTWARE - PROPRIETARYU.S. Government Restricted Rights. Use, duplication, or disclosure by the government is subject to restrictions as set forth in FAR 52.227-19 (Commercial Computer Software - Restricted Rights), DFARS 227.7202 (Commercial Computer Software and Commercial Computer Software Documentation), and in the license agreement, as applicable.Contractor/Manufacturer:SolidWorks Corporation, 300 Baker Avenue, Concord, Massachusetts 01742 USAPortions of this software © 1999, 2002-2006 ComponentOnePortions of this software © 1990-2006 D-Cubed Limited.Portions of this product are distributed under license from DC Micro Development, Copyright © 1994-2006 DC Micro Development, Inc. All rights reservedPortions of this software © 1998-2006 Geometric Software Solutions Co. Limited.Portions of this software are © 1997-2002 Macromedia, Inc.Portions of this software © 1986-2006 mental images GmbH & Co. KGPortions of this software © 1996-2006 Microsoft Corporation. All Rights Reserved.MoldflowXpress is © 2005 Moldflow Corporation. MoldflowXpress is covered by US Patent No. 6,096,088 and Australian Patent No. 721978.

Page 3: Dispatch Guide

Table of contents

Introduction.................................................................................................................................................. 4Installation................................................................................................................................................... 4

Installing dispatch for 64 bit operating systems.........................................................................................5Administrate Actions.................................................................................................................................... 6

Dispatch Examples................................................................................................................................... 8Edit action................................................................................................................................................... 9Create the Command script....................................................................................................................... 12Commands................................................................................................................................................ 13

Cancel PDMWorks Enterprise command................................................................................................13Combo box............................................................................................................................................. 13Check in file........................................................................................................................................... 13Check out file......................................................................................................................................... 14Copy file................................................................................................................................................. 14Create folder.......................................................................................................................................... 15Delete file............................................................................................................................................... 15Edit box.................................................................................................................................................. 15For all documents................................................................................................................................... 16End for all documents............................................................................................................................. 16For all configurations.............................................................................................................................. 16End for all configurations........................................................................................................................ 16Generate parameter file.......................................................................................................................... 16Get file................................................................................................................................................... 18Jump...................................................................................................................................................... 18Label...................................................................................................................................................... 18Move local folder.................................................................................................................................... 19OK messagebox..................................................................................................................................... 19Send message....................................................................................................................................... 20Rename file............................................................................................................................................ 20Shell execute.......................................................................................................................................... 21Wait....................................................................................................................................................... 21Write registry value................................................................................................................................. 22Yes-No message box............................................................................................................................. 22

Variables................................................................................................................................................... 24User-defined variables............................................................................................................................ 24Pre-Defined Dispatch Variables..............................................................................................................27String Functions..................................................................................................................................... 27File Variables......................................................................................................................................... 29

Page 4: Dispatch Guide

Page 4 of 30

INTRODUCTION

PDMWorks Enterprise Dispatch is a module to further automate tasks and processes in PDMWorks Enterprise. The module is fully customizable and configurable to accommodate support for any type of task or process.

PDMWorks Enterprise Dispatch integrates seamlessly into a PDMWorks Enterprise file vault and can be made to trigger on a number of events in PDMWorks Enterprise. For instance, whenever a document reaches a certain workflow state, PDMWorks Enterprise Dispatch is triggered and starts up a script that creates a PDF- file of the document.

INSTALLATIONNote. PDMWorks Enterprise Dispatch is an add-in module and can only be installed by a user with sufficient rights to install and administer add-ins. Once installed, the module will be distributed and available from any client connected to the file vault in which it was installed.

1. Extract the file “Dispatch.dll” to a temporary folder. (Note. Dispatch is located on the install CD under \Support\Dispatch )

2. Open PDMWorks Enterprise Administration tool and expand the vault where Dispatch should be installed.

3. Right click on Add-ins and select Open.4. Click the button New and browse to the extracted “Dispatch.dll” file. Select the file then click Open. 5. When PDMWorks Enterprise Dispatch is loaded, the Administrate Add-ins dialog will look as follows.

6. Click OK to close the dialog.

Installing dispatch for 64 bit operating systems

Page 5: Dispatch Guide

Page 5 of 30

If you plan on using dispatch on 64 bit operating systems, you must also add the “Dispatch64.dll” file in order for dispatch to work on these systems. To do this:

1. Open the administration tool on a 64 bit operating system.2. Right-click Add-ins and select Open.

If the 32 bit (Dispatch.dll) module is already added, press the Add Files… button and add the Dispatch64.dll file as well.

If no dispatch add-in is added yet, press the New… button and select both Dispatch.dll and Dispatch64.dll (CTRL-select both files).

3. When correctly added, the File name section should list both files:

Page 6: Dispatch Guide

Page 6 of 30

ADMINISTRATE ACTIONSTo access the PDMWorks Enterprise Dispatch administration tool, do as follows:Note. Only the PDMWorks Enterprise “Admin” user will have the Tools menu option available – other users must use the administration tool option.

1. Log in as Admin in the file vault where PDMWorks Enterprise Dispatch is installed.2. Select in the menu, Tools => Administrate actions.

Or:

1. Open the administration tool and expand the file vault – log in as a user that has permission to administrate add-ins

2. Expand add-ins and right-click on the Dispatch.caf add-in. Select Administrate actions.

Page 7: Dispatch Guide

Page 7 of 30

The Administrate Actions dialog will show:

The Administrate Actions dialog:Installed actions Lists the available Dispatch action scripts.Add Click to add a new Dispatch action.Edit Select an existing action in the list and click Edit to modify the action.Remove Select an action from the list and click Remove to delete the action.Load Click to import an exported Dispatch action file (.acn).Save Select an action from the list and click Save to export the action to a file (.acn)Copy Select an action from the list and click Copy to copy the action.Paste Paste a previously copied action.

Page 8: Dispatch Guide

Page 8 of 30

Dispatch ExamplesYou will find a selection of various dispatch script examples on the install CD under \Support\Dispatch\Dispatch Examples. Note: The scripts and sample tools are delivered as is and should be used as reference only.

To import an example script, do as follows:

1. Open the Administrate actions dialog.2. Click the Load button and select the .acn dispatch script to import.

3. The script will be imported and you can modify or save it as needed.

Page 9: Dispatch Guide

Page 9 of 30

EDIT ACTIONTo define a new PDMWorks Enterprise Dispatch action (or edit an existing one) open the Edit action dialog:

4. Open the Administrate actions dialog.5. Click the Add button.6. The Edit Action dialog shows.

The Edit action dialog:Action name Enter a name for the action (will show in the Installed action list of the previous

dialog).Description Enter a description of the action.Menu command Tick the box to show the entered menu command that should activate the action. The

menu command will be available in the right mouse button menu for users logged in to the file vault

During state transition

If you want the action to activate every time file vault files reach a certain workflow state, tick the box and click the Conditions button. The following dialog appears:

Page 10: Dispatch Guide

Page 10 of 30

Enter in which path files should reside that will trigger the action. Use “%” as wildcard character (a single % will trigger the action on files in the whole vault).

Select in the drop down list, which target workflow state should trigger the action (i.e. selecting “Engineering Workflow.Approved” will start the action every time a file in the specified path is sent to the Approved state in the Engineering workflow).

Select if the action should trigger after (default) or before the state is changed on the file.

During check out If you want the action to activate every time a file’s mode is changed (Check out, check in etc.), tick the box and click the Conditions button. The following dialog appears:

Enter in which path files should reside that will trigger the action. Use “%” as wildcard character (a single % will trigger the action on files in the whole vault).

Select in the drop down list, which file mode should trigger the action (i.e. selecting “Check in” will start the action every time a file residing in the specified path is checked in).

Select if the action should trigger after (default) or before the condition is changed on the file.

Note that if a file is checked in without any changes made to it, it will trigger an undo check out condition.

During add If you want the action to activate every time a file is added to the file vault, tick the box and click the Conditions button. The following dialog appears:

Page 11: Dispatch Guide

Page 11 of 30

Enter in which path files should reside that will trigger the action. Use “%” as wildcard character (a single % will trigger the action on files in the whole vault).

Select if the action should trigger after (default) or before the add operation is completed.

Commands Lists the commands that should be performed whenever the action is activated. The list is evaluated from top to bottom.

Add Click to add a new command (see Commands below)

Remove Select a defined command in the list and click to remove this command. Use CTRL to select multiple commands.

Edit Select a defined command in the list and click to modify the parameters of the command (see Commands below).

Move up Moves a selected command up one line in the command list.

Move down Moves the selected command down one line in the command list.

Variables… Click to edit the dispatch variables (see Variables below).

Page 12: Dispatch Guide

Page 12 of 30

CREATE THE COMMAND SCRIPTWhen the Dispatch action is triggered, the command script will start evaluating a set of commands. To add commands do as follows.

1. Click the Add button2. Use the drop-list in the Select command dialog to select which command to add.

3. Depending on which command is selected (see description of commands below) a second dialog will show where you enter specifics related to the command.

4. Click OK.5. Add the next command until you have completed the script.

Page 13: Dispatch Guide

Page 13 of 30

COMMANDSThe following commands are available in PDMWorks Enterprise Dispatch:

Note! In all command dialog strings, variables are included by enclosing the variable name with % signs (for example the string “The drawing: %DrawingNumber% is plotted”, where %DrawingNumber% is “1234” will when evaluated read “The drawing: 1234 is plotted”)

Also, all paths entered MUST be exact paths. Use % as wildcard. For example %\PROJECT\% will trigger for the path “c:\PDMWorks Enterprise views\Vault\PROJECTS\”

Cancel PDMWorks Enterprise commandAdding this command to the script will stop the current PDMWorks Enterprise event that triggered the dispatch action. For example, if dispatch is set to trigger when a document is approved, and the file being approved must contain a certain variable – you can add a jump in the script that cancels the state change if the variable is not found.

Combo boxDisplays a dialog to the user with a drop-down list containing choices. The selected list item is stored in a Dispatch runtime variable for later use.

Combo box settingsPrompt string – Enter a string that should be shown to the user when the command is evaluated.

Variable name – Select a Dispatch runtime variable to store the user selected choice in. Select from defined

runtime variables in the list or click to define a new variable. (A runtime variable is a temporary “container” to hold the value that is chosen in the combo box. You can then re-use that value by using the runtime variable).

Selectable choices – Click the Add button to add a new choice presented to the user when the combo box is shown. Select in the list and click the Remove button to remove a choice.

User dialog shown when the above combo box is evaluated:

Check in fileChecks in a file (in the file vault) that is checked out by the current user.

Page 14: Dispatch Guide

Page 14 of 30

If changes have been made to the file, a new version is created using the check in comment defined in the dialog.

If no changes have been made to the file, undo check out is performed on the file. If file is not checked out, or checked out by other user, an error dialog will appear.

Check in file settingsFilename – Enter the exact path (including filename) to the file that should be checked in.

Click to insert variables.

Comment – Enter the version comment that should be used when checking in the file. Click

to insert variables.

Check out fileChecks out a file (stored in the file vault) to the user triggering the Dispatch action.

Check out file settingsFilename – Enter the exact path (including filename) to

the file that should be checked out for editing. Click to insert variables.

Copy fileCopies a file to a defined destination. Note! It is the version of the file that is currently stored in the local cache that will be copied. If no version is cached, the latest available will be copied. Be sure to combine this command with “Get file” in order to retrieve the correct version.

Copy file settingsSource file – Enter the exact path (including filename) to the source file that should be copied. To add a

defined variable click the button (for example a variable containing the selected file path).

Destination file – Enter the exact path (including filename) to where the copied file should be placed. To

select a defined variable click the button (for example a variable containing the destination filename).If the destination already exists, a warning will show.

Page 15: Dispatch Guide

Page 15 of 30

Create folderCreates a new folder in the specified destination. Note! If folder already exists, a warning message will show when the command is evaluated.

Create folder settingsFolder name – Enter the exact path (including the folder name) to the location where the folder should be

created. To add a defined variable click the button (for example a variable containing the folder name).

Delete fileRemoves a specified file.

Delete file settingsFilename – Enter the exact path (including filename) to the file that should be deleted. To add a defined variable

click the button (for example a variable containing the filename).

Also remove file from vault – If the specified file is stored in a file vault, check this to also remove the file from the vault. If not checked only the cached local copy will be removed.

Edit boxDisplays a dialog in which the user can enter a value. The value is stored in a runtime variable for later use.

Edit box settingsPrompt string – Enter a string that should be shown to the user when the command is evaluated.

Variable name – Select a Dispatch runtime variable to store the user answer in. Select from defined

runtime variables in the list or click to define a new variable. . (A runtime variable is a temporary “container” to hold the value that is entered in the edit box. You can then re-use that value by using the runtime variable).

User dialog shown when the above edit box command is evaluated:

Page 16: Dispatch Guide

Page 16 of 30

For all documents Indicates the start of a block in which the following scripted commands are applied on all selected files, one file at a time. Note! If a block is not specified the scripted commands will only run once, even if multiple documents are selected. For instance if you select 100 files and activate a Dispatch action you do not want to have 100 dialog boxes shown. Most likely you would only like to have one in which you select for example “Printer” or “Plotter” and then have all 100 files sent to the selected device.

End for all documentsIndicates the end of a block of commands starting with “For all documents”

Example:This dispatch action will first show an edit box (once) letting the user enter a destination folder – and then evaluate the Copy file command on each of the selected files that has triggered Dispatch.

For all configurationsIndicates the start of a block in which the following commands will be applied on each of the found configurations (i.e. Layout/model space for dwg files, Configurations for Solidworks files). Note! If the configuration block is not specified, only the default configuration of the file will be evaluated.

End for all configurationsIndicates the end of a block of commands starting with “For all configurations”

Example:This dispatch action will execute a shell command for each of the found Configurations in the selected file

Generate parameter fileGenerates a text file containing expanded variable values (for example values from the file data card of the selected files). The content and variables in the generated file is based on a predefined template.

Generate parameter file settings

Page 17: Dispatch Guide

Page 17 of 30

Template – Exact path (incl. Filename) of the file that should act as template for the generated file. This ANSI style template should contain static text and dynamic dispatch variable names (%variable%) to be replaced in the generated file.

Click to browse for the file.

Filename – Enter the exact path (incl. Filename)

of the file to be generated. Click to browse for an existing file.

Use counter... – Check this to add a unique counter number for each generated file. The counter is added after the filename, before the extension (Export1.txt, Export2.txt…).

Append to file… - Check this to append the results based on the template, if the selected file exists.

Assign filename to – Select a Dispatch runtime variable to assign the current filename to for later use. . (A runtime variable is a temporary “container” to hold the value of the parameter file filename. You can then re-use that value by using the runtime variable).

Example:1. This dispatch action will generate a list of the selected files based on the template. The append option is activated, making sure the result is added to the same file.

2. The template file contains one predefined variable that will be replaced with the evaluated variable value at runtime. (Any static text in the template file will remain in the generated file).

3. The Dispatch action is triggered on three selected files.

4. Once the Dispatch action is complete, a text file has been generated containing the filenames (the evaluated variable %NameOfSelectedFile%) of the selected files.

Page 18: Dispatch Guide

Page 18 of 30

Get fileRetrieves a copy of the specified file to the local cache. Use this command to make sure that the latest available file version is used when Dispatch runs.

Get file settingsFilepath – Enter the exact path (including filename) to the file that should be retrieved.

To add a defined variable click the button (for example a variable containing the filename).

Get latest if missing – The file will only be retrieved if it is missing in the local cache.

Get latest if missing or earlier version – The latest version of the file will be retrieved, regardless of version stored in the cache.

JumpDefines that the command script should perform a conditional jump to a predefined Dispatch command label.

Conditional jump settingsIf… – Enter the string or variable that should match the defined condition to make the jump (for example if file exists,

then jump…). Click to add variables.

Conditions (select one):Always Always jump to specified label, even if

string is not true.= If string matches below specified string,

then jump to specified label.> If string value is greater than below

specified string value, then jump to specified label.

>= If sting value is greater than, or equal to, below specified string value, then jump to specified label.

!= If string does not match below specified string, then jump to specified label.

Exists as local

If specified file exists locally, then jump to specified label.

Exists in vault

If specified file exists in vault, then jump to specified label.

…then goto label – Select a predefined Dispatch command label to jump to if the defined conditions are met.

LabelDefines a Dispatch label in the command script.

Page 19: Dispatch Guide

Page 19 of 30

Label settingsLabel name – Enter a name for the label (used together with the conditional Jump command).

Move local folderMoves or renames a local folder.Note! Folders stored in the file vault cannot be moved with this command.

Move local folder settingsOld folder name – Enter the exact path (including folder

name) to the folder that should be moved. Click to insert variables.

New folder name - Enter the exact path (including folder name) to target location where the folder should be moved. To rename a folder, keep the target path identical

to the source but use a new folder name. Click to insert variables.

OK messageboxDisplays a message dialog to the user. User will have to click OK to close the dialog. Note! The Dispatch command script is halted until user closes the dialog.

OK messagebox settingsString to display – Enter a string to display in the OK message box. Use the enter key to create a line

break. Click to insert variables.

Example:User dialog shown when the above OK messagebox is evaluated:

Page 20: Dispatch Guide

Page 20 of 30

Send messageSends a simple message to a selected group or user

Send message settingsTo – Select which groups or users should receive the message.

Subject – Enter the message subject.

Message – Enter the message body. It is possible to use HTML tags in the body.

Note that it is not possible to use pre-defined or user-defined variables in either subject or body

Above action will generate the following notification:

Rename fileRenames a file

Page 21: Dispatch Guide

Page 21 of 30

Rename file settingsPath to file – Enter the exact path (including filename)

to the file that should be renamed. Click to insert variables.

New filename – Enter the new filename (and extension), without path.

Shell executeLaunches a file with optional parameters. Used to, for example, send a file to a .pdf generating program.

Shell execute settingsVerb – System command that should be use to call the specified filename (Open, Edit, Print, Explore, Find ). If no verb is selected, the “Open” is used by default.

Filename – Enter the exact path of file to execute, or file to be used with above selected

system verb. Click to insert variables.

Parameters – Enter any additional parameters that should be sent to the executed file. (for example switches, or name of file to process

etc.). Click to insert variables.

Halt execution of script… - Check this to have the Dispatch command script halt until shell execute is completed.

WaitHalts the Dispatch command script until a certain condition is filled.

Wait settingsWait until… – Select the condition that should let the script continue in the drop-down list:

File is created File is deleted Registry value is set

Filename – Enter the exact path to the file that should be created/deleted for the script to

continue. Click to insert variables.

Registry value – Enter the exact registry key

Page 22: Dispatch Guide

Page 22 of 30

name that should be created for the script to

continue. Click to insert variables.

Write registry valueCreate or update a registry value.Note! The logged in user that triggers Dispatch must have sufficient rights to update the selected registry key. It is recommended to use the HKEY_CURRENT_USER section for this.

Write registry value settingsKey – Enter the full registry key and registry value container that should be updated. If the value container does not exist it will be created. (Keys must exist)

Value – Enter the value that should be

written. Click to insert variables.

String/DWORD – Select if value should be stored as string or DWORD in the registry.

Example:1. Using the following registry “key” and container:

HKEY_CURRENT_USER\Software\SolidWorks\Applications\PDMWorks Enterprise\Vaults\DispatchFile

2. Using the following “Value”:%NameOfSelectedFile%

3. When the script is run, the following registry value is created and updated with the current name of file that is processed:

Yes-No message boxDisplays a dialog where user can select Yes or No. The value of the selection is stored in a Dispatch runtime variable for later use.

Yes-No Messagebox settings

Page 23: Dispatch Guide

Page 23 of 30

Prompt string – Enter a string that should be shown to the user when the command is evaluated.

Variable name – Select a Dispatch runtime variable to store the user selected choice value in. Select from defined runtime variables in the

list or click to define a new variable. (A runtime variable is a temporary “container” to hold the value that is chosen in the message box. You can then re-use that value by using the runtime variable).

Selectable choices YES value – This value will be stored

in the defined runtime variable when user selects Yes.

NO value - This value will be stored in the defined runtime variable when user selects No.

This user dialog is shown when the above Yes-No Messagebox is evaluated. When user clicks the Yes button, the value “Y” is stored in the “Choice” variable for later use:

Page 24: Dispatch Guide

Page 24 of 30

VARIABLESYou can define (and use pre-defined) PDMWorks Enterprise Dispatch variables that will evaluate when the Dispatch action is run. These variables could for example contain the name of the selected file, or the value of a file’s file data card.

Variables are included in strings by enclosing the variable name with “%” signs, for example “%PathToSelectedFile%” would evaluate to the path and filename of the currently selected file when the Dispatch action is run.

User-defined variablesUse the Set variables dialog to set up user defined variables. To access the Set variables dialog, click the Variables button in the Edit action dialog, or select Userdefined Variables => Edit Variables from the pre-defined variable sub-menu.

The Set variables dialog:Variables Lists the name and information about the user-defined variablesAdd Click to add a new user-defined variableName Enter a name for the user defined variable. This variable name is then referred to

from command-strings by enclosing it in % signs (for example, the variable above is referred to as %VersionValue% ). Note that the name may not be the same as one of the predefined file variables.

Type Select what type of variable should be used. Depending on the selected type, different option fields will appear to further specify the type. The following variable types are available:

Page 25: Dispatch Guide

Page 25 of 30

Example:You can use the user defined variables section to build up a new variable value that is a combination of several other values. For example, it would be possible to combine the Part Number and Revision of the below file to a single variable.

1. Create a user defined variable “Number” that reads the part number from the file data card.

Page 26: Dispatch Guide

Page 26 of 30

2. Create a user defined variable “Rev” that reads the revision from the file data card.

3. Create a third variable “PublishedName” using a static string that combines the two other variables into a new value.

4. You can now use the user defined variable in the dispatch script, for example in a message box. Either

type the variable name enclosed in % signs, or select it from the button menu :

Page 27: Dispatch Guide

Page 27 of 30

5. The following message is shown when the dispatch script is run.

Pre-Defined Dispatch VariablesWhen defining Dispatch commands, in most dialog boxes you can access the pre-defined and user defined

variables by clicking the button. A submenu will appear listing several pre-defined variables. The following image displays all pre-defined variables accessed from this sub-menu.

String FunctionsYou can manipulate fixed strings and variable values using the string functions.

LeftReturns the first (leftmost).specified number of characters from a specified string.Syntax ArgumentsLeft(abc, 2) abc – The character string, 2 – Number of charactersExample: Left(ProjectAA, 7) returns “Project”

RightReturns the last (rightmost) specified number of characters from a specified string.Syntax ArgumentsRight(abc, 2) abc – The character string, 2 – Number of charactersExample: Right(ProjectAA, 2) returns “AA”

Page 28: Dispatch Guide

Page 28 of 30

MidReturns a substring from a specified string (starting at any position)Syntax ArgumentsMid(abc, 1, 2) abc – The character string, 1 – Starting position, 2 – Number of charactersExample: Mid(ProjectAA,3,2) returns “oj”

LengthReturns the length of a specified string.Syntax ArgumentsLength(abc) abc – The character stringExample: Length(ProjectAA) returns “9”

ReverseReturns the reverse of a specified string.Syntax ArgumentsReverse(abc) abc – The character stringExample: Reverse(stockholm) returns “mlohkcots”

FindSearches a specified string for the first match of a character or substring. Syntax ArgumentsFind(abc, b) abc – The character string, b – the character to look forExample: Find(abcdef, c) returns “2”

ReverseFindSearches a specified string for the last match of a character.Syntax ArgumentsReverseFind(abc, b) abc – The character string, b – the character to look forExample: ReverseFind(abcabc, b) returns “4”

CurrentTimeReturns the current date or time in a specified format.SyntaxCurrentTime(%%Y-%%m-%%d %%H:%%M:%%S)Arguments%%a Abbreviated weekday name%%A Full weekday name%%b Abbreviated month name%%B Full month name%%c Date and time representation appropriate for locale%%d Day of month as decimal number (01 – 31)%%H Hour in 24-hour format (00 – 23)%%I Hour in 12-hour format (01 – 12)%%j Day of year as decimal number (001 – 366)%%m Month as decimal number (01 – 12)%%M Minute as decimal number (00 – 59)%%p Current locale's A.M./P.M. indicator for 12-hour clock%%S Second as decimal number (00 – 59)%%U Week of year as decimal number, with Sunday as first day of week (00 – 53)%%w Weekday as decimal number (0 – 6; Sunday is 0)%%W Week of year as decimal number, with Monday as first day of week (00 – 53)%%x Date representation for current locale%%X Time representation for current locale%%y Year without century, as decimal number (00 – 99)%%Y Year with century, as decimal number%%z, %%Z Either the time-zone name or time zone abbreviation, depending on registry settings; no

characters if time zone is unknown %%%% Percent sign

Page 29: Dispatch Guide

Page 29 of 30

Example: CurrentTime(%%y%%m%%d) returns “050113”CurrentTime(%%H:%%M) returns “09:53”

Arithmetic Functions

AddReturns the first (leftmost).specified number of characters from a specified string.Syntax ArgumentsLeft(abc, 2) abc – The character string, 2 – Number of charactersExample: Left(ProjectAA, 7) returns “Project”

RightReturns the last (rightmost) specified number of characters from a specified string.Syntax ArgumentsRight(abc, 2) abc – The character string, 2 – Number of charactersExample: Right(ProjectAA, 2) returns “AA”

File VariablesThe following pre-defined file variables are available. Note that they will return information about the current file that is processed in a “For all documents” block loop.

The following file is used for the returned values listed below.

Option Variable Returns valueName of selected file %NameOfSelectedFile% 89-NOAO-4200-1234.sldprtPath to selected file %PathToSelectedFile% C:\2008 x32 b54\FolderA\89-NOAO-4200-

1234.sldprtDirectory of selected file %DirOfSelectedFile% C:\2008 x32 b54\FolderACurrent revision of selected file %CurrentRevisionOfFile% ACurrent version of selected file %CurrentVersionOfFile% 4Selected files current workflow state

%SelectedFileCurrentWorkflowState% Approved

Name of user who created the file %NameOfUserCreatedFile% AdminTime when selected file was created

%TimeFileCreated% 20070726 14:44:1

Time when selected file was modified

%TimeFileModified% 20070726 17:04:12

Current configuration %CurrentConfig% @Note: Use a “For all configurations” loop.

Page 30: Dispatch Guide

Page 30 of 30

Path to roof folder %RootFolderPath% C:\2008 x32 b54Current folder path %CurrentFolderPath% C:\2008 x32 b54\FolderAName of current folder %NameOfCurrentFolder% FolderAName of current vault %NameOfCurrentVault% 2008 x32 b54Name of logged in user %NameOfLoggedInUser% Admin