Application Note: Sourcing scripts into production readout atomatcally on startup. Ron Fox (fox at nscl dot msu dot edu) Sometimes, users of the production readout software need to source a tcl script when the program starts up. This can be done using the extensibility of the Readout Gui. When the readout gui starts, it searches for a file named ReadoutCallouts.tcl in ~ and ~/experiments/current. If found, this file is sourced prior to creating the GUI. All instances of the file are sourced. The file can contain arbitrary initialization code (for example you could create a toplevel widget that contains user interface elements to extend the GUI provided by ReadoutGUI. You can also define any of the following proc's to be called by the ReadoutGUI as follows: OnStart - Called when the readout program has been started. OnBegin - Called when the run is just about to start. This proc Receives the run number as a parameter OnEnd - Called when the run has just ended. This proc receives the run number as a parameter. OnPause - Called when the run has just paused. This proc receives the run number as a parameter. OnResume - Called just prior to resuming a paused run. This proc receives the run number as a parameter. The script below is a sample ReadoutCallouts.tcl script that sources a TCL Script into a production readout program whenever it is started. #---------------------- Script starts ----------------------------- package require ReadoutControl proc OnStart {} { after 500 set scriptfile "~/experiment/current/essentialinitialization.tcl" set f [open $scriptfile r] set contents [read $f] close $f ReadoutControl::SendCommand $contents } #-------------------- Script ends ----------------------------------