Jump to content

noob need help for "while" command

Recommended Posts

Hello, i tryed to work with imagesearch, therfore i did take the example of the help forum. ANd i did try to adapt for me.

my problem now is, that i am to silly to end the while command. i want the programm to end the while for the funktion "KZ" and go on with the function "test".

Can some1 please help me?



;~ Opt("MustDeclareVars", 1)
;~ #AutoIt3Wrapper_UseX64=y
;~ #AutoIt3Wrapper_Change2CUI=y
;~ #RequireAdmin

#include "_ImageSearch_UDF.au3"

HotKeySet("{Esc}", "_Exit") ; Press ESC for exit
Func _Exit()
    Exit 0
EndFunc   ;==>_Exit

Global Const $Mouse_Click_On_Found = 1

Global Const $iSleep_Time=500

$_Image_1 = @ScriptDir & "\kz.png"
$_Image_2 = @ScriptDir & "\kz1.png"
$_Image_3 = @ScriptDir & "\kz_ns.png"

ConsoleWrite("! Search for images: " & $_Image_1 & @CRLF & '! Searching on the screen ...' & @CRLF)

call ("_Kz")

func _Kz()

While 1
    ToolTip('(Press ESC for EXIT) Searching ...', 1, 1)
    Local $return = _ImageSearch($_Image_1)    
    If $return[0] = 1 Then
        If $Mouse_Click_On_Found Then MouseClick("left", $return[1], $return[2])


        Local $return2 = _ImageSearch($_Image_2)
        If $return2[0] = 1 Then
            If $Mouse_Click_On_Found Then MouseClick("left", $return2[1], $return2[2])


        Local $return3 = _ImageSearch($_Image_3)
        If $return3[0] = 1 Then
            If $Mouse_Click_On_Found Then MouseClick("left", $return3[1], $return3[2])


call ("_test")

Func _test()
        MsgBox($MB_SYSTEMMODAL, "", "Hello")
EndFunc   ;==>Test1

Link to post
Share on other sites

Pretty sure you just replace that and it should be fine, also use the brackets on the forums to help with inserting autoit code

Replace: call ("_Kz") with _Kz()

Also: call ("_test")  --->    _test()

Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    No registered users viewing this page.

  • Create New...