TaskCreateScript

<< Click to Display Table of Contents >>

Navigation:  Programming Mechworks PDM > DBWCommandShell > Commands Reference > TaskManager >

TaskCreateScript

Description

This command allows to start programmatically the definition of a generic .vbs script to be processed later by the TaskManager: it could have a list of document unique id's as input parameters or not.
The methods should be used together with the TaskAppend (if there are any document to append as input parameters) and the TaskSubmit (to submit the task definition as a new effective task of the TaskManager) shell methods.

Syntax

call DBWShell("TaskCreateScript scriptName taskWsName taskPriority ")

Parameter

scriptName

full path name of the script

taskWsName

involved working server name

taskPriority

task execution priority:1: low
2: normal
3: high

Example

This code creates a task to execute a script named Test.vbs with specific records' unique_id:

call DBWShell("TaskCreateScript C:\MechWorks_Pdm_Server\lst\Test.vbs DBWorksExecuter1 2")

call DBWShell("TaskAppend 241,242,245") ' this line is optional
call DBWShell("TaskSubmit")

This is the code of the script Test.vbs reading passed unique_ids and increment their revision state:

'.x64

Sub main()
 DBWInit(TRUE)
 docUids = DBWInput("@DOCUMENTS_UID_LIST") 'to retrieve input UID parameters
 tokens = Split( docUids,"," )
 for i = 0 to ubound(tokens)
  Call DBWShell("IncrementRevisionState " & tokens(i))
 next
End Sub

21-Nov-22