找回密码
 加入
搜索
查看: 1593|回复: 3

[GUI管理] 请高手门指教,为何编译后显示为设置变量

[复制链接]
发表于 2010-3-12 16:34:59 | 显示全部楼层 |阅读模式
请高手门指教,为何编译后显示为设置变量
$g_szVersion = "天气预报"
If WinExists($g_szVersion) Then Exit ; 此脚本已经运行了
AutoItWinSetTitle($g_szVersion)

Opt("GUICloseOnESC", 0)
Opt("TrayAutoPause", 0)
Opt("TrayMenuMode", 1)
Opt("TrayOnEventMode", 0)
Opt("TrayIconHide", 0)
#include <IE.au3>
Local Const $weatherFile = "天气预报.ini"
Local Const $city = IniRead($weatherFile, "天气预报", "城市编号", "166")
IniWrite($weatherFile, "天气预报", "城市编号", $city)

$Url = "http://weather.qq.com/inc/07_ss" & $city & "/.htm"
$oIE = _IECreate($Url, 0, 0)
$sHTML = _IEBodyReadHTML($oIE)

$array = StringRegExp($sHTML, "<(?i)td height=77 class=wht2 lk37><div class=txbd>(.*?)</(?i)div>", 1)
For $i = 0 To UBound($array) - 1
        $tqtemp = $array[$i]
Next
$weather = StringReplace($tqtemp, " ", " ")

$array2 = StringRegExp($sHTML, "</(?i)div>(.*?)</(?i)td>", 1)
For $i = 0 To UBound($array2) - 1
        $tqtemp2 = $array2[$i]
Next
$weatheren = StringReplace($tqtemp2, " ", " ")

$array3 = StringRegExp($sHTML, "<(?i)td class=whp3 lk37>(.*?)<(?i)br>", 1)
For $i = 0 To UBound($array3) - 1
        $tqtemp3 = $array3[$i]
Next
$wind = StringReplace($tqtemp3, " ", " ")

IniWrite($weatherFile, "天气预报", "天气", $weather)
IniWrite($weatherFile, "天气预报", "温度", $weatheren)
IniWrite($weatherFile, "天气预报", "风力", $wind)


_IEQuit($oIE)
Exit
 楼主| 发表于 2010-3-12 16:35:43 | 显示全部楼层
在线求等。
发表于 2010-3-12 18:28:51 | 显示全部楼层
IE操作方面我不太明白。帮你顶。估计可能哪个函数的返回值
发表于 2010-3-12 19:18:30 | 显示全部楼层
什么是“编译后显示为设置变量”,你是指程序不工作,还是指运行错误,
如果是运行错误的可能原因是,你的$tqtemp,$tqtemp2,$tqtemp3三个变量都是在FOR循环里,如果的其它代码不工作的话比如:$array = StringRegExp($sHTML, "<(?i)td height=77 class=wht2 lk37><div class=txbd>(.*?)</(?i)div>", 1)那么你的FOR循环也不会工作,当FOR循环不执行时,你下面的语句$weather = StringReplace($tqtemp, " ", " ")就相当于没有声明而直接引用了$tqtemp变量所以会也错
以上只是个人推断,不知道是不是这样,在开头加上Dim $tqtemp,$tqtemp2,$tqtemp3之后运行不会报错。
您需要登录后才可以回帖 登录 | 加入

本版积分规则

QQ|手机版|小黑屋|AUTOIT CN ( 鲁ICP备19019924号-1 )谷歌 百度

GMT+8, 2024-5-21 05:19 , Processed in 0.080261 second(s), 24 queries .

Powered by Discuz! X3.5 Licensed

© 2001-2024 Discuz! Team.

快速回复 返回顶部 返回列表