cosmo scripting
Cosmo supports scripting from both a file and a network connection.
cosmoscript files
There are two types of scripting files, depending on file extension (.scr or .script). A ".scr" script is a Tcl/Tk script and can contain local variables, loops, and new graphical windows. The ".script" is a more limited script which executes sequentially.
cosmoscript server
The cosmoscript server can be enabled from the cosmo menus. Cosmo can listen over a newwork socket for .script commands. The other end of the socket can be on the same machine or on a different machine and operating system using a differnt programming language.
example .scr cosmo script
set vmeslot 6
set mfec 1
set idelay 50
proc testvmefec { command } {
global vmeslot
toplevel .testpfec -class Dialog
wm title .testpfec "TEST FEC with COSMOSCRIPT"
label .testpfec.label -text "FEC tester cosmo
script" -fg "blue"
-padx 10 -font { Helvetica 18 {bold}}
pack .testpfec.label
button .testpfec.b1 -text "mfec1" -command {
vmefecsetaddresses $vmeslot 1
}
button .testpfec.b2 -text "mfec2" -command {
vmefecsetaddresses $vmeslot 2
}
button .testpfec.b3 -text "mfec3" -command {
vmefecsetaddresses $vmeslot 3
}
button .testpfec.b4 -text "mfec4" -command {
vmefecsetaddresses $vmeslot 4
}
button .testpfec.b5 -text "mfec5" -command {
vmefecsetaddresses $vmeslot 5
}
button .testpfec.b6 -text "mfec6" -command {
vmefecsetaddresses $vmeslot 6
}
button .testpfec.b7 -text "mfec7" -command {
vmefecsetaddresses $vmeslot 7
}
button .testpfec.b8 -text "mfec8" -command {
vmefecsetaddresses $vmeslot 8
}
button .testpfec.b9 -text "EXIT" -command {
exit
}
pack .testpfec.b1
pack .testpfec.b2
pack .testpfec.b3
pack .testpfec.b4
pack .testpfec.b5
pack .testpfec.b6
pack .testpfec.b7
pack .testpfec.b8
pack .testpfec.b9
set width [winfo screenwidth .]
set height [winfo screenheight .]
set x [expr ($width/2) - 200]
set y [expr ($height/2) - 200]
wm geometry .testpfec +$x+$y
wm resizable .testpfec 0 0
update
}
testvmefec 1
example .script cosmo script
config "outformat paw24" pixel_chipload 2 adc_sample 10 pixel_chipload 3 adc_sample 10 pixel_chipload 1 adc_sample 50 pixel_chipload 4 adc_sample 20 dacset_byname VCal 1 adc_sample 10 dacset_byname VCal 2 adc_sample 10 dacset_byname VCal 3 adc_sample 10 dacset_byname VCal 4 adc_sample 10 dacset_byname VCal 5 adc_sample 10 pixel_chipload 1 setdcol 1 ON pixel_chipload 2 setdcol 2 ON pixel_chipload 3 setdcol 4 ON pixel_chipload 4 setdcol 8 ON

