找回密码
 加入
搜索
查看: 2710|回复: 2

[图形处理] 找图程序 运行之后报错(子脚本使用了非数组变量) 大哥们帮忙看看

[复制链接]
发表于 2013-10-27 10:45:20 | 显示全部楼层 |阅读模式
本帖最后由 w1314ich 于 2013-10-27 12:20 编辑

代码如下:
#include <ImageSearch.au3>

Dim $x1, $y1, $s1 = 0, $s2 = 0
While 1
        Sleep(100)
        If $s1 <> 1 Then
                $result = _ImageSearch("城镇路径1.bmp", 1, $x1, $y1, 0)
                If $result = 1 Then
                        MouseClick("left", $x1, $y1, 1)
                        $s1 = 1
                Else
                        ContinueLoop
                EndIf
        EndIf
        If $s2 <> 1 Then
                $result2 = _ImageSearch("城镇路径2.bmp", 1, $x1, $y1, 0)
                If $result2 = 1 Then
                        MouseClick("left", $x1, $y1, 1)
                        $s2 = 1
                Else
                        ContinueLoop
                EndIf
        EndIf
        ExitLoop
WEnd

是在这篇帖子里找的 http://www.autoitx.com/forum.php ... hlight=%D5%D2%CD%BC

运行之后报错 子脚本使用了非数组变量

本帖子中包含更多资源

您需要 登录 才可以下载或查看,没有账号?加入

×
发表于 2013-10-27 11:18:59 | 显示全部楼层
贴一下报的错呗。
发表于 2013-11-6 23:49:57 | 显示全部楼层
我没有ImageSearch.au3 估计是调用dll类的udf,我个人的使用经验在au3里多次调用dll赋值的变量前最好先

把变量原有的值清空!
While 1
        Sleep(100)
        If $s1 <> 1 Then
               dim $x1="",$y1=""
                $result = _ImageSearch("城镇路径1.bmp", 1, $x1, $y1, 0)
                If $result = 1 Then
                        MouseClick("left", $x1, $y1, 1)
                        $s1 = 1
                Else
                        ContinueLoop
                EndIf
        EndIf
        If $s2 <> 1 Then
                 dim $x1="",$y1=""
                $result2 = _ImageSearch("城镇路径2.bmp", 1, $x1, $y1, 0)
                If $result2 = 1 Then
                        MouseClick("left", $x1, $y1, 1)
                        $s2 = 1
                Else
                        ContinueLoop
                EndIf
        EndIf
        ExitLoop
WEnd
您需要登录后才可以回帖 登录 | 加入

本版积分规则

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

GMT+8, 2024-5-4 03:32 , Processed in 0.078331 second(s), 24 queries .

Powered by Discuz! X3.5 Licensed

© 2001-2024 Discuz! Team.

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