找回密码
 加入
搜索
查看: 1175|回复: 5

关于使用了非数组变量的错误

[复制链接]
发表于 2009-8-15 15:39:50 | 显示全部楼层 |阅读模式
本帖最后由 lvsea2008 于 2009-8-15 17:26 编辑


有时打开有有时打开没有
而且出现此提示后再执行下就可以运行且也没有提示了!
发表于 2009-8-15 16:07:00 | 显示全部楼层
这个问题很简单,不过没有源码就无从说起了。一般出错在缺少必要的条件语句
 楼主| 发表于 2009-8-15 16:13:53 | 显示全部楼层
这个是源码
Opt("GUICoordMode",1)
Opt("TrayIconHide",1)
GUICreate("窗口标题",300,19,-1,-1,-1,-1,WinGetHandle(AutoItWinGetTitle()))
WinSetOnTop("窗口标题","",1)
Opt("MouseCoordMode", 1)
$sizeopt = WinGetPos("窗口")
$xsizeopt = $sizeopt[0]+137
$ysizeopt = $sizeopt[1]+100
WinMove("窗口标题", "", $xsizeopt, $ysizeopt)
GUISetState ()
$b1 = GUICtrlCreateButton ("WAS", 0,0,61,19)
$b2 = GUICtrlCreateButton ("SDCF",61,0,61,19)
$b3 = GUICtrlCreateButton ("ERTY",122,0,61,19)
$b4 = GUICtrlCreateButton ("YTU",183,0,61,19)
$b5 = GUICtrlCreateButton ("TYT",244,0,61,19)
While 1
$msg = GUIGetMsg()
If $msg = $b1 Then
Run(@ProgramFilesDir&"\123\QWE.exe")
EndIf
If $msg = $b2 Then
Run(@ProgramFilesDir&"\123\Exp.EXE")
EndIf
If $msg = $b3 Then
Run(@ProgramFilesDir&"\123\lVoice.exe")
EndIf
If $msg = $b4 Then
Run(@ProgramFilesDir&"\123\Run.exe")
EndIf
If $msg = $b5 Then
$url = "http://hi.baidu.com/"
Run(@ProgramFilesDir & "\Internet Explorer\iexplore.exe -new " & $url)
EndIf
wend
发表于 2009-8-15 16:38:41 | 显示全部楼层
你这很可能是没有获取到目标“窗口”坐标,加个判断:
Opt("GUICoordMode", 1)
Opt("TrayIconHide", 1)
GUICreate("窗口标题", 300, 19, -1, -1, -1, -1, WinGetHandle(AutoItWinGetTitle()))
WinSetOnTop("窗口标题", "", 1)
Opt("MouseCoordMode", 1)
$sizeopt = WinGetPos("窗口")
If @error <> 1 Then
        $xsizeopt = $sizeopt[0] + 137
        $ysizeopt = $sizeopt[1] + 100
Else
        $xsizeopt = 0
        $ysizeopt = 0
EndIf
WinMove("窗口标题", "", $xsizeopt, $ysizeopt)
GUISetState()

$b1 = GUICtrlCreateButton("WAS", 0, 0, 61, 19)
$b2 = GUICtrlCreateButton("SDCF", 61, 0, 61, 19)
$b3 = GUICtrlCreateButton("ERTY", 122, 0, 61, 19)
$b4 = GUICtrlCreateButton("YTU", 183, 0, 61, 19)
$b5 = GUICtrlCreateButton("TYT", 244, 0, 61, 19)
While 1
        $msg = GUIGetMsg()
        If $msg = $b1 Then
                Run(@ProgramFilesDir & "\123\QWE.exe")
        EndIf
        If $msg = $b2 Then
                Run(@ProgramFilesDir & "\123\Exp.EXE")
        EndIf
        If $msg = $b3 Then
                Run(@ProgramFilesDir & "\123\lVoice.exe")
        EndIf
        If $msg = $b4 Then
                Run(@ProgramFilesDir & "\123\Run.exe")
        EndIf
        If $msg = $b5 Then
                $url = "http://hi.baidu.com/"
                Run(@ProgramFilesDir & "\Internet Explorer\iexplore.exe -new " & $url)
        EndIf
WEnd
 楼主| 发表于 2009-8-15 17:26:24 | 显示全部楼层
谢谢您的帮助
问题已经解决!
发表于 2009-8-19 04:39:41 | 显示全部楼层
呵呵 感谢。我也遇到了同样的问题。
您需要登录后才可以回帖 登录 | 加入

本版积分规则

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

GMT+8, 2024-5-17 15:19 , Processed in 0.077209 second(s), 20 queries .

Powered by Discuz! X3.5 Licensed

© 2001-2024 Discuz! Team.

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