VBScript Behavior: Data Sheet  

Accessing this behavior This behavior can be accessed by clicking the VBScript Behavior icon () in the Implementation toolbar.
Describing this behavior This behavior is designed to run a VBScript (or catvbs files) or to reference a VBA project to call a specified sub located in a specified module. The behavior and the type can be arguments of the macro, thus enabling you to use BKT automation interfaces (used to manage arguments) directly on the behavior.
  • VB Script: The behavior can be passed as an argument for Scripts (VB and VBA scripts) enabling you to retrieve the VBScript behavior inputs. The extended object is also passed as a second argument. These 2 arguments are optional. You can call a function that takes no arguments, only 1 (in this case it will always be the behavior), or 2 arguments (the behavior and the extended object.) You can also specify the routine name to call. By default, if no routine is specified, the CATMain is launched.
  • VBA: You can reference an external catvba file, and specify the module name and the routine to run. As for VB Script, the behavior itself and the extended object can be optional arguments for the called routine.
EXAMPLE You will find below a VB sample that illustrates how the use of the 2 arguments simplifies VB/VBA coding.
Sub CATMain(Beh, ExtObj )

'The VB Script Behavior is directly accessible
Set AttOnBeh = Beh.GetOutput("AttonBehVB") (1)

'We get the list of parameters on the Extended object
'i.e attribute on technological type and Product/Part parameters
Set ExtObjParameters = ExtObj.Parameters
Dim ParamOnType
Set ParamOnType = ExtObjParameters.Item("AttOnType") (2)

'The value of the type attribute is displayed
MsgBox "Value Att. on Type" & ParamOnType.Value
'The value of the behavior attribute is displayed
MsgBox "value Att. On Behavior: " & AttOnBeh.Value

Beh.PutOutput "AttonBehVB", ParamOnType
'The value of the behavior attribute is displayed taking into account the type value
MsgBox "Value AttOnBeh after valuation: " & AttOnBeh.Value

End Sub
  • (1) Output attribute of the behavior.
  • (2) Type attribute.
 In VBA, you must specify the inputs type. The prototype of CATMain is: Sub CATMain(Beh As behavior, ExtObj As Object).
Using this Behavior Interface


Name: Name attributed to the behavior.
Comment: Comment attributed to the behavior.
Language: VB Script: Reference a .CATScript or a .catvbs file. The macro file must be stored in the <CATKnowledgePath>knowledgeResources\automation directory.
VBA: Reference an external catvba file.
Macro Name Enter the name of the file that you want to use.
Click to select a file.
Click Edit to launch the VB/VBA editor. If a file name is already specified in the Library Name input, the editor opens the corresponding file.
Module Name Enter the module name. This is available in VBA mode only. The input is a script file name, *.CATScript, *.catvbs, *.catvba. If no Module is specified, the behavior cannot be operated.
Routine Name Enter the name of the routine to launch. By default, if no routine name is specified, the CATMain of the specified module is called.
2 arguments can be provided to the called routine: The behavior itself (equivalent of this object) and the extended object.
With the Script Behavior itself as an argument, you can directly access the behavior in your macro, allowing you to call BKT automation methods to valuate and retrieve behaviors parameters.
Defined inputs and parameters Click Add/Modify/Delete to define/modify/delete the inputs and the parameters that will be retrieved using the exposed automation methods.
The selected  file must be located in <CATKnowledgePath>\knowledgeResources\automation and in <CATStartupPath> for upward compatibility. Enter the VBScript file name only.