This is the new home of the egghelp.org community forum.
All data has been migrated (including user logins/passwords) to a new phpBB version.
For more information, see this announcement post. Click the X in the top right-corner of this box to dismiss this message.
Help for those learning Tcl or writing their own scripts.
-
COBRa
- Halfop
- Posts: 49
- Joined: Fri Jan 04, 2013 8:23 am
Post
by COBRa »
hi im writing a script to give me a better number output im using this code to achieve it
Code: Select all
proc isy:sizeconvert { totalsize } {
set tsize $totalsize
set tsize "[format "%.2f" $tsize]\00315MB\003"
if {$totalsize >= 1024 && $totalsize < 1048576} {
set tsize [expr $totalsize / 1024] ·
set tsize "[format "%.2f" $tsize]\00315GB\003"
}
if {$totalsize >= 1048576} {
set tsize [expr $totalsize / 1024 / 1024];
set tsize "[format "%.2f" $tsize]\00315TB\003"
}
return $tsize
}
and the output line is this
Code: Select all
set sizecount [isy:sizeconvert [lindex $row 3]]
but when i action the script i receive this error
Tcl error [isy:group]: wrong # args: should be "set varName ?newValue?"
any help would be appreciated
-
SpiKe^^
- Owner
- Posts: 831
- Joined: Fri May 12, 2006 10:20 pm
- Location: Tennessee, USA
-
Contact:
Post
by SpiKe^^ »
This may be the error line...
Code: Select all
set tsize [expr $totalsize / 1024] ·
Make that more like this maybe...
Code: Select all
set tsize "[expr $totalsize / 1024] ·"
Better yet, what's the deal with the · anyway?? just get rid of that...
Code: Select all
set tsize [expr $totalsize / 1024]