可以通过编辑代码,指定规则参数编辑器中未提供的参数。
为操作指定参数的代码类似以下:
Public Sub ConfigureAction( _
ByVal triggerEvent As Creo.PWS.Automation.PrinergyDataModel.InputFileCreatedEvent, _
ByVal action As Creo.PWS.Automation.PrinergyDataModel.RefineAction)
' — Assign the value of the action parameter "InputFiles" —
action.InputFiles = triggerEvent.InputFiles
' — Assign the value of the action parameter "ProcessTemplatePath" —
action.ProcessTemplatePath = "Storage:Archive:Archive:ArchiveAll"
' — Assign the value of the action parameter "Comment" —
' action.Comment = some value expression
End Sub
如果在用户界面中未指定某个参数的值,该参数在代码中将显示为注释。您必须取消它的注释符号,并为其赋值。
指定静态值
静态值是每次触发规则时都相同的值,例如要使用的处理模板、收件电子邮件地址、要使用的优先级等。
'--- Assign the value of the Action Parameter "Comment" ----
action.Comment = "This is a test comment"
'--- Assign the value of the Action Parameter "Priority" ----
action.Priority = 2
指定事件属性
事件属性是动态值 - 每次触发规则时它们会改变。将事件的属性指定给操作的参数:
'--- Assign the value of the Action Parameter "Job" —
action.Job = triggerEvent.Job
'--- Assign the value of the Action Parameter "UserName" —
action.UserName = triggerEvent.Process.UserName
指定带有嵌入属性的字符串
您可能会希望构造静态值与事件属性值组合的字符串。这对于电子邮件消息特别有用。
'--- Assign the value of the Action Parameter "Subject" —
action.Subject = ("Failed refine in Job " + triggerEvent.Process.Job.Name + ".")