JMRI is...

Scripting

Information on writing scripts to control JMRI in more detail:

Python and Jython (General Info)

JMRI scripts are in Jython, a version of Python, a popular general-purpose computer language

Tools

JMRI provides powerful tools for working with your layout.

Layout Automation

Use JMRI to automate parts of your layout, from simply controlling a crossing gate to running trains in the background.

Supported Hardware

JMRI: Scripting

Writing and executing a "script" (program in Python/Jython or other language - see below) is a way of telling JMRI to execute commands specific to your JMRI environment and to partially or even fully automate your layout and train operations. Scripts can be as simple as telling JMRI to set a single sensor or as complex as setting up multiple objects and running multiple trains based on feedback from your layout. While there is no comprehensive JMRI scripting manual, the examples provided in the pages linked below will be a primary source of information on how to use scripting to great advantage with JMRI. The "How To" and "What-Where" sections also provide many ideas and hints gleaned from the JMRI community on scripting features and capabilities.

The following pages discuss scripting JMRI using the Jython version of Python:

See also the help section on Python and JMRI.

Any Java Scripting API (commonly refered to JSR-223) compliant scripting language can be added to JMRI, however, only JavaScript and Python (Jython) are directly supported in the default installation. If you want to add another scripting language, find a JSR-223 compliant interpreter and add it to the JMRI classpath as documented for your operating system (different operating systems have different launchers that are configured differently).