qq451763407 发表于 2012-7-29 16:59:46

请教,语句问题

Dim $temp = ""
    $objWMIService = ObjGet("winmgmts:\\.\root\WMI")
    $colItems = $objWMIService.ExecQuery("SELECT * FROM MSAcpi_ThermalZoneTemperature")
    $temp = ""
    For $objItem in $colItems
      $temp &= "CurrentTemperature: " & ($objItem.CurrentTemperature - 2732) / 10 & "°C" & @LF
    Next
    ToolTip(StringTrimRight($temp,1),100,0)
    $objWMIService = 0
if $temp>25°Cthen
msgbox (0,0,"温度高于25度")
请教下,上面那里错了,如何修改才能让它条件成立

xms77 发表于 2012-7-29 17:39:41

Dim $temp = ""
    $objWMIService = ObjGet("winmgmts:\\.\root\WMI")
    $colItems = $objWMIService.ExecQuery("SELECT * FROM MSAcpi_ThermalZoneTemperature")
    $temp = ""
    For $objItem in $colItems
      $temp &= "CurrentTemperature: " & ($objItem.CurrentTemperature - 2732) / 10 & "°C" & @LF
    Next
    ToolTip(StringTrimRight($temp,1),100,0)
    $objWMIService = 0
        $digital = StringRegExp($temp,'\d+',1)
       
if $digital>25   Then msgbox (0,0,"温度高于25度")回复 1# qq451763407
字符串不好比较真实的大小,要转化为数字来比较。

魔导 发表于 2012-7-29 18:27:06

呵呵,很像我哦。{:face (355):}

lpxx 发表于 2012-7-29 18:37:40

if $temp>25°Cthen

{:face (356):}

qq451763407 发表于 2012-7-30 08:22:28

多谢二楼,问题解决
页: [1]
查看完整版本: 请教,语句问题