hoDemo2Par - Helmut-Ortmann/EnterpriseArchitect_hoTools GitHub Wiki

hoDemo2Par.vb

Example VB Script to use with hoTools Script. Just:

  • Create a Normal Script Group
  • Create a VB Script
  • Replace existing code with the following code into a VB Script.

Code

'EA-Matic
'[path=\Framework\ho\hoTools]
'[group=hoTools]
!INC Local Scripts.EAConstants-VBScript
' Dim doesn't work (syntax error)
' Object 'Session' doesn't exist (use  Repository.WriteOutput "Script", "MyTest",0)
' Var 'Repository' is loaded
' You may create an instance 'EAAddinFramework.Utils.Model' of the first running EA-Instance

function hoDemoPrintContext(modelItem, objectType)
    'Dim itemType as 5
	itemType = "unknown"
	Select Case objectType
	    Case otElement
			itemType = "Element"
		Case otPackage
			itemType = "Package"
		Case otDiagram
			itemType = "Diagram"
		Case otAttribute
			itemType = "Attribute"
		Case otOperation
			itemType = "Operation"
	End Select
	Dim s 
	s = "hoDemoPrintContext: Context item is: '" + modelItem.Name + "' of type '" + itemType + "'"
    ' Output to EA			
    Repository.EnsureOutputVisible("Script") 
	Repository.WriteOutput "Script", s, 0
end function