Scripts in JMRI are written in a version of Python called Jython. For more information see the JMRI web site.
Test script
This is my first attempt at automating part of the (incomplete) layout. It takes the loco, 61243 a BR B1 4-6-0, from the bay platform points back to the bridge on the main line and them out along the quay side. It then reverses the journey and ends up where it started from.
You can view the script here.