# This Jython script created by MRRM software from MTS Associates # Copyright 2004 # Loads/Runs all triggerable scripts; no Transponder support import jarray import jmri print "Execfile to establish global names for scripts; do not autostart script" execfile("jython/Scripts/Run_Blue Loop Test.py") execfile("jython/Scripts/Run_LAyard_AnthEl.py") class autoMgr(jmri.jmrit.automat.AbstractAutomaton) : def init(self): #This code will be run once use_dispatcher=1 #Virtual turnout LT2047 stops all scripts print "autoMgr: command turnout = LT2047 to CLOSED" self.LT2047 = turnouts.provideTurnout("LT2047") self.LT2047.setCommandedState(CLOSED) print "autoMgr: define script triggers and set all triggerable scripts to stopped" print "autoMgr: command turnout = LT2005 to CLOSED for Run_Blue Loop Test" self.LT2005= turnouts.provideTurnout("LT2005") self.LT2005.setCommandedState(CLOSED) self.Run_Blue Loop Test_state = "Stopped" print "autoMgr: command turnout = LT2003 to CLOSED for Run_LAyard_AnthEl" self.LT2003= turnouts.provideTurnout("LT2003") self.LT2003.setCommandedState(CLOSED) self.Run_LAyard_AnthEl_state = "Stopped" def handle(self): #This code will be restarted continuously once invoked #print "autoMgr: handle method for autoMgr" #print "autoMgr: activate all triggerable scripts" if self.Run_Blue Loop Test_state == "Stopped" : Blue Loop Test().start() self.Run_Blue Loop Test_state = "Running" if self.Run_LAyard_AnthEl_state == "Stopped" : LAyard_AnthEl().start() self.Run_LAyard_AnthEl_state = "Running" #print "autoMgr: check LT2047 for THROWN to stop all scripts" if self.LT2047.getCommandedState() == THROWN : #turnout LT2047 stops all scripts when THROWN return 0 #print "autoMgr: check LT2005 for THROWN to stop script Run_Blue Loop Test " if self.LT2005.getCommandedState() == THROWN : #turnout LT2005 restart script Run_Blue Loop Test when THROWN self.Run_Blue Loop Test_state = "Stopped" self.LT2005.setCommandedState(CLOSED) #print "autoMgr: check LT2003 for THROWN to stop script Run_LAyard_AnthEl " if self.LT2003.getCommandedState() == THROWN : #turnout LT2003 restart script Run_LAyard_AnthEl when THROWN self.Run_LAyard_AnthEl_state = "Stopped" self.LT2003.setCommandedState(CLOSED) self.waitMsec(10000) #wait for 10 seconds between runs return 1 # run again! # end of class definition #activate the script autoMgr().start()