[已解决]如何讓條件成立就動作, 不成立就重複檢查
本帖最后由 ipmitool 于 2017-1-10 09:09 编辑想讓 $result>0的時候, 就做動作
WinActivate("")
_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("")
_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 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("")
_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 突然自己想通了, 已解決, 謝謝嘍~
页:
[1]