Enterprise Architect version 15.0

download
purchase

enzh-CNcsnlfrdehiiditkoplptruskessv

My Profile

Social Media Channels

facebook  twitter  youtube   linkedin

Monday, 31 December 2018 20:19

Use Java, C# & Co for your Scripting

Written by
Rate this item
(0 votes)

Use the power of modern IDEs and languages like Java, C#, F#, VB, or C++ for your EA Scripting. Here you find everything you need for a quick-start.

Develop your solution, let's say a Text to Speech application for selected EA items. Code it in your favourite language with all the benefits of your IDE - the developing, debugging, version control and your life-cycle. In short, professional software development with a state of the art IDE.

Just add one line of code in EA VB Scripts to call this Text to Speech application for Browser, Diagram, Model Search.

You find an error, a new release, no big deal. Just deploy the application at your desktop.



PowerScripting.png

Benefits

  • Well known Software Life-Cycle
  • Let IDE and compiler work for you
  • A vast amount of libraries, examples and tutorials
  • Easy testing and debugging

Principle

One line of code in VB Script and you are in your Java, C#, VB, F#, C++ environment!
 

EA: VB Script glue-code


' Run the C#, VB, F#, C++ Console Programm,
result = RunCommand(myScript.exe, "DoTask1", guid, "", "") ' C# vb script glue-code
 
 
' Run the Java Class, let Java do everything
result = RunCommandJava("%EA_SCRIPT_HOME%", "SparxSystems.RepositoryInterface", " ", " "," ", " ") ' Java vb script glue-code
 

Example in C#

Other languages are similar.

switch (command) { // Decide what to do
    case: "TextToSpeech":
          var el = _repository.GetElementByGuid (guid); // get the passed element
          _repository.ShowInProjectView(el); // show the passed element in project browser
    break;

    case: "DoTask2":
    break;
}

Example Java

public void PrintPackage( org.sparx.Package pkg)
{
      Trace( pkg.GetName());
      Collection<org.sparx.Package> packages = pkg.GetPackages();
      for(short i = 0; i < packages.GetCount(); i++)
      {
            PrintPackage(packages.GetAt(i));
      }

}

Summary

You find the whole article, the code, an EA-Repository and the Tutorial at GitHub, ScriptDotNet.

Converting the glue-code from VB Script to JScript or JavaScript is no big deal.  

Read 963 times Last modified on Sunday, 06 January 2019 22:28
Helmut Ortmann

Helmut Ortmann

Freelancer (Consultant)
 
I'm a German freelancer in the area of Enterprise Architects and software/system engineering. A large part is embedded and Functional Safety with EA. But not only...
 
According to Albert Einsteins aphorism "Make things as simple as possible, but not simpler” I like to smoothen work with Addins and an easy to use EA Tool integration in a complex development environment. Another step in my opinium are lively workshops to get an enjoyable and long lasting launch of the daily EA work.
 
Well, of course that’s not all and you have therefore good reasons to contact me. See you….
 
See my hoTools WiKi at GitHub.

www.hoModeler.de

1 comment

  • Comment Link Perry Vickers Tuesday, 11 June 2019 18:32 posted by Perry Vickers

    Hi Helmut,

    Very interesting post.

    I assume this approach could also work for Python programs?
    Have you any experience with doing so?

    Best Regards,
    Perry

Login to post comments