Top Community Contributors
Enterprise Architect User Group: London 2017
Written by DT_Sam
RepoDoc, a call for testing
Written by ArchimetesRead more...
- We are Profiling EA Users
Managing a student project with Enterprise Architect - Part 4
Written by doug rosenberg
- CIO Review's 20 Most Promising BPM Solution Providers 2017
- Sparx Systems Pro Cloud Server - Coming Soon
- SD Times - How UML makes a DevOps-driven digital transformation possible
Use C#, Java, for your VB Scripting
Written by Helmut Ortmann
EA Version 13 supports developing in C# and Java with full EA API support. They name it Hybrid Scripting. This article shows you with a little example how to use C# for your Scripting. After you have understood C#, it should be easy to use Java in a similar way. The main idea is to use a small wrapper you call within your VB Script. Of course, after you have understood it's also easy to write this little wrapper for JavaScipt/JScript.
Just insert the line:
- 'RunCommand("myLogic.exe, "", " ")'
in your VB Script and you are done with VBScript to call your C#. Java would be similar.
Let's make a quick example with EA Version 13 and C#:
Make an EA C# ConsoleApplication
- Create a new EA Project
- Create a Package ('Select and Apply Model Pattern')
- C#, RepositoryInterface 4.0
- Build the Application
- Have a look in the generated Application
- c:\temp\hybrid\RepositoryInterface 4.0\
Import VBScript wrapper to call C#
- Configure, Transfer, Import Reference Data
- Make EA Scripting visible
- Code, Scripting (you may have to refresh Scripts)
- You see the new VB Scripts inside the ScriptGroup HybridScripting:
Run C# ConsoleApplication.exe
- Adapt VBScript RunCommandTest
- Adapt path to 'ConsoleApplication.exe'
- Line:28/29 Needed references
- Line:35 Path to *.exe which executes your logic
- Line:36 The call of the wrapper, result contains the StandardOutput of the Script
- Run VBScript RunCommandTest
- Right Click on RunCommandTest
- Run Script
How do you use it
There are two approaches: Generates you VB Script by inserting the the wrapper Call in the EA templates at the appropriate location. The other way is to remove the template and just call the wrapper like
'result = RunCommand("myLogic.exe, "", " ")'
instead of the using the template scuffold.
Under the hood
EA delivers the two dlls:
They expect the Process ID, first parameter, to know which EA Instance the *.exe wants to use. So, RunCommands makes:
- Estiminate the own Process ID
- Call 'RunCommand...'
- Reads the Standard output from your *.exe
- Returns to Standard output to the caller
Inside the *.exe you have full access to the EA API.
- SPARX Webinar Hybrid Scripting
- SPARX Tutorial Hybrid Scripting
- hoTools Hybrid Scripting
- RunCommand.vbs (The wrapper to call your C#, Java,..)
- RunCommandTest.vbs (An Example with EA example C# Hybrid Script ConsoleApplication.exe, see Tutorial )
"VBScript and JScript require the Microsoft Process Debug Manager (PDM.dll) to be installed on the local machine; this is available through various Microsoft products including the free 'Microsoft Script Debugger'"
(refer to: http://sparxsystems.com/enterprise_architect_user_guide/13.0/automation/debug_scripts.html)
The issue is: Microsoft Script Debugger as is - is depricated and here is the list (not complete for sure), where PDM is part of:
* Office 2000-2007
* Visual Studio
* Visual Studio Remote Tools (PDM stays installed even after uninstall of the Remote Tools)
Depending on the used operating system of Microsoft you will find Process Debug Manager (PDM.DLL) in the following folders:
Windows Vista, Windows 7, Windows 8, Windows 8.1 (64bit)
C:\Program Files (x86)\Internet Explorer\pdm.dll
Windows Vista, Windows 7, Windows 8, Windows 8.1 (32bit)
C:\Program Files\Internet Explorer\pdm.dll
Windows 10 _before_ v1607
Windows 10 (64bit)
Windows 10 (32bit)
This file (pdm.dll) must be registerd manually using regsvr32.
Windows 10 v1607:
in this version manual installation of pdm.dll is not possible anymore. So you have to install a Microsoft Product that contains PDM.dll.
I recommend using the "Remote Tools for Visual Studio 2015 Update 3"
After installation you can uninstall them - because PDM.DLL resists and can be used by Enterprise Architect.