Script Editor

Access Astah models via scripting languages to perform what Astah’s standard functionality does not offer.

See sample scripts.


Compatible with
Astah Professional 6.6 or later and UML, GSN 1.0 or later
Latest Version
1.0.4 (Updated: August 12, 2015)
No technical support is provided.

If you are using Astah System Safety, please read this page for how to use the Script Editor and sample scripts.


How to Install on Astah Professional

If you are using Astah Pro 7.2 or later, the script editor is included already, so skip to “How to use”.

  1. Download the Plug-in file.
  2. Unzip it. There are some sample script files in the “sample_scripts” folder.
    Astah Script Editor
  3. Drag the downloaded .jar file to an open instance of Astah. A pop-up will appear asking you to confirm installation, choose [Yes].
  4. If the pop-up below opens, restart Astah and open any project.
    Astah Plugin Install
  5. If you see the [Script Editor] option under [Tools], the installation is complete!
    Script Edito
  6. Go to “How to Use”



How to Install on Astah GSN

  1. Save the downloaded .jar file under Userhome/.astah/gsn/plugins. (You will find the .jar file after unzipping the downloaded package.)
    Astah Script Editor
  2. Launch Astah GSN, if you see the [Script] option under [Tool], the installation is complete!
  3. Go to “How to Use”


How to Use

  1. Open a project file you want to use scripts for.
  2. Go to [Tools] – [Script Editor] or [Script] from the main menu to open a script editor.
  3. Write script in upper window or go to [Script] – [Open] and select the .js files. (Sample Scripts)
  4. Click the arrow button or go to [Action] – [Run] to run the script.
    Run Script Editor
  5. The result appears in the bottom window.
    Script Editor Result
  6. You can save your scripts from [Script] – [Save as].



Sample Scripts

You can find script samples on Sample Scripts page.
Also, if you download the plug-in files from the [Download] button at the top of this page, you will get the following sample .js files.

addSetterGetter Add Setter/Getter to target Attributes
addStereotypeToSelectedModel.js Add stereotype to target models
checkEdition.js Show the version of currently-used Astah
countClasses.js Show a number of Classes that are included in the currently-open project
createAndOpenDiagram.js Create a new Class diagram
createEREntities.js Create new ER entities with specific logical names and physical namess
exportCsv.js Export model information to CSV format file
printClasses.js List up all the Class names in the currently-open diagram
printERIndex List up all the Index information of all the ER models
printMindmapTopics.js List up all the topics in currently-open Mind Map
printPackageAndClassInfo.js List up all the package and class names
printPresentationProperties.js List up all the property information of target model element
searchAndEdit.js Search a class by keyword and add a specific color and note to it
searchMessagesWithoutOperation.js List up all the Messages without operations in Sequence diagrams
useJavaGUI.js Open a dialog to enable you to use Java GUI

Sample scripts may not work on old version of Astah. If you are using Astah Pro 6.9 or earlier, use the sample scripts in the [sample scripts] – [java7] folder. Also some somple scripts do not work with Astah Community because it does not provide support edit API.


Available predefined variables in the script

projectAccessor projectAccessor object in Astah API. null means there is no project file in Astah.
astah same as projectAccessor
astahWindow Main window of Astah
scriptWindow Window object of the Script Editor


Related Contents


Using other Scripting Language

You can use other scripting language for this Script Editor if you have OSGi bundle and JSR223 jar files.

  1. Download a .jar file of the scripting language you wnt to use. (e.g: groovy-all.jar. jruby-###.jar)
  2. Save the .jar file in the plugins folder in your home directory.
    If you are using Astah Pro, USER_HOME\.astah\professional\plugins
  3. Restart Astah.
Back to Plugin List

What are you looking for?