sex123 发表于 2012-1-2 18:48:52

系统提示line35wend无对应while,而我明明是有while,为何?

源代码写完后,系统提示line35wend无对应while,而我明明是有while,为何?

$i=10869
$n=1
$x=979
$y=91
$a=413
$b=493
Sleep (5000)
While $i > 3
      Sleep (10)
                $n=1
    Send ("!d")
      Sleep (10)
      Send("http://star.sgst.cn/questionDetail.do?id=" & $i)
      Sleep (10)
      Send ("{ENTER}")
      Sleep (1000)
      MouseMove ($x,$y)
      while $n < 300
             If PixelGetColor ($x, $y) = '0xffffff' Then
                         MouseMove ($a,$b)
                         Sleep (100)
                                               If PixelGetColor ($a, $b) <> '0xffffff' Then
                                                     Send("{Home}")
                                                     Sleep(9000)
                                                     Send("{End}")
                           ExitLoop
                                                     Sleep(100)
                                               Else
                                                       ExitLoop
                                               
             Else
               sleep(1000)
               $n = $n + 1
             EndIf
      WEnd         
      Sleep (1000)
    $i = $i + 1
WEnd

hzxymkb 发表于 2012-1-2 18:52:11

本帖最后由 hzxymkb 于 2012-1-2 18:53 编辑

IF语句错误!

sex123 发表于 2012-1-2 18:54:17

IF语句错误!
hzxymkb 发表于 2012-1-2 18:52 http://www.autoitx.com/images/common/back.gif


    愿听详解。

hzxymkb 发表于 2012-1-2 18:57:56

回复 3# sex123


   你把所有代码发上来!不然我也帮不了你!
你这代码会死循环的!

sex123 发表于 2012-1-2 19:00:13

回复sex123


   你把所有代码发上来!不然我也帮不了你!
你这代码会死循环的!
hzxymkb 发表于 2012-1-2 18:57 http://www.autoitx.com/images/common/back.gif


    本来就是一个死循环,永远执行下去,一直到人为干扰,我只要把基中的while和wend这个无对应的问题解掉即可,另外,上面代码是全部的代码。

hzxymkb 发表于 2012-1-2 19:01:26

回复 5# sex123


    你当我土包子啊,你这个send是发送到哪?

sex123 发表于 2012-1-2 19:03:58

opera的地址栏中。

hzxymkb 发表于 2012-1-2 19:30:12

回复 7# sex123 $i = 10869
$n = 1
$x = 979
$y = 91
$a = 413
$b = 493
Sleep(5000)
While $i > 3
        Sleep(10)
        $n = 1
        Send("!d")
        Sleep(10)
        Send("http://star.sgst.cn/questionDetail.do?id=" & $i)
        Sleep(10)
        Send("{ENTER}")
        Sleep(1000)
        MouseMove($x, $y)
        While $n < 300
                If PixelGetColor($x, $y) = '0xffffff' Then
                        MouseMove($a, $b)
                        Sleep(100)
                        If PixelGetColor($a, $b) <> '0xffffff' Then
                                Send("{Home}")
                                Sleep(9000)
                                Send("{End}")
                                ExitLoop
                                Sleep(100)
                        Else
                                ExitLoop
                                Sleep(1000)
                                $n = $n + 1
                        EndIf
                EndIf
        WEnd
        Sleep(1000)
        $i = $i + 1
WEnd

sex123 发表于 2012-1-2 19:47:30

搞定,试验成功。一会研究一下,我差在什么地方了。谢谢版主。

sex123 发表于 2012-1-2 20:32:09

还是不对,
while $n < 300
这个语句好像失效了

sex123 发表于 2012-1-2 20:50:49

我是首先打开在opera,然后判断opera地址栏后面的进度栏(x,y)是否变白,如果变白,则将鼠标移动到星星的位置(a,b),然后点击星星,如果进度栏(x,y)没有变白,说明正在读网页,这时用循环每秒判断进度栏,直到变白时,移动到星星,这种判断最长5分钟。如果没有星星,则星星的位置(a,b)是白色,则不点击,直接进入下一个循环。

zch11230 发表于 2012-1-2 21:04:09

本帖最后由 zch11230 于 2012-1-2 21:07 编辑

我只知道语法上少了个ENDIF...ELSE用得不准确 $n+=1在exitloop之后相当于已经满足这个条件时 但在$n+=1执行之前就退出循环了也就是说$n值没变.这代码干嘛的不知道.

半芯蕃茄 发表于 2012-1-2 21:09:30

本帖最后由 半芯蕃茄 于 2012-1-2 21:15 编辑

While $n < 300
                If PixelGetColor($x, $y) = '0xffffff' Then
                        MouseMove($a, $b)
                        Sleep(100)
                        If PixelGetColor($a, $b) <> '0xffffff' Then
                              Send("{Home}")
                              Sleep(9000)
                              Send("{End}")
                              ExitLoop;这里已经退出了循环
                              Sleep(100);你还要个SLEEP做什么
                        Else
                              ExitLoop;这里已经退出了循环
                              Sleep(1000);你还要个SLEEP做什么
                              $n = $n + 1
                        EndIf
                EndIf
      WEnd我怎么看怎么都像是已经退出循环了。。。。

sex123 发表于 2012-1-4 12:33:57

无解了吗?没人帮帮我了吗?

user3000 发表于 2012-1-4 17:30:14

无解了吗?没人帮帮我了吗?
sex123 发表于 2012-1-4 12:33 http://www.autoitx.com/images/common/back.gif

$i = 10869
$n = 1
$x = 979
$y = 91
$a = 413
$b = 493
Sleep(5000)
While $i > 3
        Sleep(10)
        $n = 1
        Send("!d")
        Sleep(10)
        Send("http://star.sgst.cn/questionDetail.doid=" & $i)
        Sleep(10)
        Send("{ENTER}")
        Sleep(1000)
        MouseMove($x, $y)
        While $n < 300
                If PixelGetColor($x, $y) = '0xffffff' Then
                        MouseMove($a, $b)
                        Sleep(100)
                        If PixelGetColor($a, $b) <> '0xffffff' Then
                                Send("{Home}")
                                Sleep(9000)
                                Send("{End}")
                                ExitLoop
                                Sleep(100)
                        Else
                                ExitLoop
                        EndIf
                Else
                        Sleep(1000)
                        $n = $n + 1
                EndIf
        WEnd
        Sleep(1000)
        $i = $i + 1
WEnd
建议你用编辑器编辑代码时, 不时按快捷键 Ctrl + T 整理下代码, 那样可能会更容易看出问题代码来.
页: [1] 2
查看完整版本: 系统提示line35wend无对应while,而我明明是有while,为何?