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

[AU3基础] [已解决]如何讓條件成立就動作, 不成立就重複檢查

[复制链接]
发表于 2017-1-10 08:44:33 | 显示全部楼层 |阅读模式
本帖最后由 ipmitool 于 2017-1-10 09:09 编辑

想讓 $result>0的時候, 就做動作
WinActivate("[CLASS:PuTTY]")
_Sendtext($Hwnd,"r6-disk vnc console=ttyS1,115200")
_SendKeys($Hwnd,"{ENTER}")

當不成立的時候, 就顯示 msgbox 然後重複正則 檢查 If $result > 0

這樣要怎麼寫啊...感覺continue loop不適在這個時候用的...
for $i=1 to 100

If $result > 0 Then
          WinActivate("[CLASS:PuTTY]")
          _Sendtext($Hwnd,"r6-disk vnc console=ttyS1,115200")
          ;_SendKeys($Hwnd,"{ENTER}")
          sleep(3000)


Else

MsgBox(0,"Fail", "Not found!",0.5)
sleep(3000)

EndIf



Next
 楼主| 发表于 2017-1-10 09:09:52 | 显示全部楼层
for $i=1 to 100


$fileA = @ScriptDir & "\image\anaconda.png"

_GDIPlus_Startup()

$hImageA =_GDIPlus_ImageLoadFromFile($fileA) ;this is the firefox icon use something else if you don't have it.
$hBitmapA = _GDIPlus_BitmapCreateHBITMAPFromBitmap($hImageA)

$x = 0
$y = 0

$result = _ImageSearch($hBitmapA, 1, $x, $y, 20, 0) ;Zero will search against your active screen




If $result > 0 Then
          WinActivate("[CLASS:PuTTY]")
          _Sendtext($Hwnd,"r6-disk vnc console=ttyS1,115200")
          ;_SendKeys($Hwnd,"{ENTER}")
          sleep(3000)
                ExitLoop

Else

MsgBox(0,"Fail", "Not found!",0.5)
sleep(3000)

EndIf



Next
 楼主| 发表于 2017-1-10 09:10:15 | 显示全部楼层
突然自己想通了, 已解決, 謝謝嘍~
您需要登录后才可以回帖 登录 | 加入

本版积分规则

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

GMT+8, 2024-4-24 07:57 , Processed in 0.073985 second(s), 19 queries .

Powered by Discuz! X3.5 Licensed

© 2001-2024 Discuz! Team.

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