I need to save all device parameters to a script, for loading in another project.
The export script could be based on an easier method... This one dumps all device settings and also loads them all back:
# save device settings to a script, for playback later
set theScriptFile [ open "setDevices.tcl" w ]
puts $theScriptFile "set devParams { [ devparams configure ] }"
puts $theScriptFile "foreach dp \$devParams {"
puts $theScriptFile " set name \[ lindex \$dp 0 \]"
puts $theScriptFile " foreach param \[ lindex \$dp 1 \] {"
puts $theScriptFile " devparams configure \$name \$param"
puts $theScriptFile " }"
puts $theScriptFile "}"
close $theScriptFile ;# setDevices.tcl will later restore the device settings