Script Plug-in

Access Astah via scripting languages.

  • Version: 1.0.4 (Updated: August 12, 2015)
  • For use in: Astah Professional, Astah Community (6.5.x or later), Astah SysML (1.3 or later) and Astah GSN (1.0 or later) - download
  • Created By: Change Vision, Inc
  • Get: Source Code

With this Plug-in you are able to access Astah via JavaScript. See script samples. For more information about this Plug-in and the Change Vision developer who wrote it, please read our blog.

How to use Astah through JavaScript

  • Download the Script Plug-in (.zip file) from here, and unzip it to find the script-x.x.x.jar file under the [plugins] folder.
  • Run Astah and go to [Help] - [Plugin List] menu and click [Install] button.
    anycode plugin
  • Select the .jar file and restart Astah.
    anycode plugin
  • You will find the [Script] menu has been added under the [Tool] menu
    script plugin
  • Select [Script], a new Script window will open
    script plugin

Sample Script

  1. Below is a Script Sample (download) that will write out all the Classifiers in the current project. The result will appear in the bottom window.
    with(new JavaImporter(
    com.change_vision.jude.api.inf.model)) {
    classes = astah.findElements(IClass.class);
    for(var i in classes)
    { print(classes[i].getName()); }
    }

    script plugin

Samples Available (Download All)

Add Setters and Getters
Add Stereotypes to models
Count Classes
Check Astah Edition
Create and Open a Diagram
Creat ER Entities
Export CVS
Print Classes
Print ER index
Print Mindmap topics
Print Package and Class information
Print presentaion Properties
Use JavaGUI
Search and Edit

Available predefined variables in this script

projectAccessorObject of ProjectAccessor in Astah API
astahSame as Project Accessor
astahWindowMain window object of Astah
scriptWindowWindow object of the script plugin

You are able to use the Astah API and Java API in your script.

How to build

  • Install the Astah Plug-in SDK
  • git clone git://github.com/ChangeVision/astah-script-plugin.git
  • cd script
  • astah-build
  • astah-launch

Generating config to load classpath for Eclipse;
astah-mvn eclipse:eclipse

How to switch script languages

You are able to use other script languages which support OSGi JSR223(experimental).

  • Download jar file for other script languages (ex: groovy-all.jar, jruby-###.jar).
  • Copy the jar file to the Astah plugins folder (/.astah//plugins).
  • Start Astah.

For More Information

For more information about this Plug-in and the Change Vision developer who wrote it, please see our blog.

This Plug-in works with Astah Community and Professional