proc check_myOS {} { global tcl_platform set wa 3 set w1 [string range [array get tcl_platform os] $wa $wa] if { $w1 == "\{" } { set wa [expr $wa + 1] } set re [string range [array get tcl_platform os] $wa [expr $wa + 1]] if { $re == "Da" } { return {mac} } if { $re == "Wi" } { return {win} } return $re } set w1 [check_myOS] button .b1 -text $w1 -command "exit" pack .b1