JMRI® is...
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
JMRI tools for working with your layout:
Layout Automation
Use JMRI to automate parts of your layout and operations:
Supported Hardware
JMRI supports a wide range of DCC systems, command stations and protocols.
By the community of

JMRI Help:

Contents Index
Glossary FAQ

Donate to

JMRI: Scripting

since 4.23.3

Note: The PanelPro main menu has changed. The four scripting related menu items have moved from the Panels menu item to the new Scripting menu item. The menu references in the scripting related documents show the new menu path with the old value in braces.

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