Script Editor

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

See sample scripts.

Details

Compatible with
Astah Professional 6.6 or later and UML, SysML 1.3 or later, GSN 1.0 or later
Latest Version
1.0.4 (Updated: August 12, 2015)
Developer
Astah

divider

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 by clicking the blue Download button at the top of this page.

 

    1. Unzip it. There are some sample script files in the “sample_scripts” folder.

 

    1. Drag the downloaded .jar file to an open instance of Astah. A pop-up will appear asking you to confirm installation, choose [Yes].

 

    1. If the pop-up opens, restart Astah and open any project.

 

    1. If you see the [Script Editor] option under [Tools], the installation is complete!

 

  1. Go to “How to Use”

 

How to Install on Astah SysML

    1. Download the Plug-in file by clicking the blue Download button at the top of this page.

 

    1. Launch Astah SysML and go to [Help] – [Plugin List].

 

    1. Click [Install] button and select the script-x.x.jar file you donwloaded which you can find in the unzipped folder.

 

    1. Restart Astah.

 

    1. If you see the [Script] option under [Tool], the installation is complete! (This is a screenshot of Astah Professional.)

 

    1. 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.)

 

    1. Launch Astah GSN, if you see the [Script] option under [Tool], the installation is complete!

 

  1. Go to “How to Use”

divider

How to Use

    1. Open a project file you want to use scripts for.

 

    1. Go to [Tools] – [Script Editor] or [Script] from main menu to open a script editor.

 

    1. Write script in upper window or go to [Script] – [Open] and select the .js files. (Sample Scripts)

 

    1. Click the arrow button or go to [Action] – [Run] to run the script.

 

    1. The result appears in the bottom window.
    2. 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)

 

    1. Save the .jar file in the plugins folder in your home directory.
      If you are using Astah Pro, USER_HOME\.astah\professional\plugins

 

    1. Restart Astah.

 

Back to Plugin List

What are you looking for?