diff --git a/nxsupport.tcl b/nxsupport.tcl index a4f8f5e4..6ce650de 100644 --- a/nxsupport.tcl +++ b/nxsupport.tcl @@ -2,6 +2,7 @@ # Support routines for scripting NeXus files with nxscript. # # Mark Koennecke, February 2003 +# Mark Koennecke, January 2004 #========================================================================== proc makeFileName args { sicsdatanumber incr @@ -12,13 +13,31 @@ proc makeFileName args { return [format "%s%s%5.5d2003%s" $p $pre $num $po] } #========================================================================== +# new version, attending to the new 1000 grouping logic +proc newFileName args { + set ret [catch {nxscript makefilename} msg] + if {$ret != 0} { + clientput "ERROR: Misconfiguration of file writing variables" + clientput "Defaulting filename to emergency.hdf" + set fil emergency.hdf + } else { + set fil $msg + } + return $fil +} +#========================================================================== proc writeFloatVar {alias var} { set ret [catch {set val [SplitReply [$var]]} val] if { $ret != 0} { clientput [format "ERROR: failed to read %s, %s" $var $val] return } else { - nxscript putfloat $alias [expr $val * 1.0 ] + set ret [catch {expr $val * 1.0} val] + if { $ret == 0} { + nxscript putfloat $alias [expr $val * 1.0 ] + } else { + clientput "ERROR: bad value $val when reading $var" + } } } #=========================================================================