Jump to content

Problem with _ImageSearch_Create_BMP


Recommended Posts

Hi there, I'm using _Image Search UDF 2021.8.30.2 with Example

 

 

;~ 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 $Ask_On_Found = 0
Global Const $Mouse_Move_On_Found = 1
Global Const $Mouse_Click_On_Found = 0

Global Const $iSleep_Time=500

Global $sCount = 0, $_Image_1 = @ScriptDir & "\example.bmp"

; First, use this function to create a file bmp, maybe a desktop icon for example')
MsgBox(64 + 262144, 'ImageSearch', 'At first, create a file bmp,' & @CRLF & 'photos that will search on the screen!')
_ImageSearch_Create_BMP($_Image_1)

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

While 1
    ToolTip('(Press ESC for EXIT) Searching ...', 1, 1)
    Sleep($iSleep_Time)
    $sCount += 1
    Local $return = _ImageSearch($_Image_1)
    If $return[0] = 1 Then
        ConsoleWrite('- [' & $sCount & '] Image found:' & " X=" & $return[1] & " Y=" & $return[2] & @CRLF)
        If $Mouse_Move_On_Found Then
            MouseMove($return[1], $return[2])
            Sleep($iSleep_Time)
        EndIf
        If $Mouse_Click_On_Found Then MouseClick("left", $return[1], $return[2])
        ToolTip('(Press ESC for EXIT) - [' & $sCount & "] Image found:" &  " X=" & $return[1] & " Y=" & $return[2], 1, 1)
        If $Ask_On_Found Then
            Local $ask = MsgBox(6 + 262144, 'Success [' & $sCount & ']', 'Image found:' & " X=" & $return[1] & " Y=" & $return[2])
            If $ask = 2 Or $ask = 3 Or $ask = 5 Or $ask = 7 Then Exit ;No, Abort, Cancel, and Ignore
            If $ask = 10 Then _ImageSearch_Create_BMP($_Image_1) ; Continue       ;Try Again
        EndIf
    EndIf
    Sleep(200)
WEnd

 

In Example , I can use mouse CLICK and make ScreenCapture by my self, but I dont want that. Because I have position already, I dont want have to Click to make ScreenCapture , I want my code run auto 100% non stop with my position.

 

How to do that ? 

Link to comment
Share on other sites

Could you show an example of the screen you want to click on.  Because it is looking as you want to automate a game, please refer to forum rules, as you will not get any help if it is your intention.

Link to comment
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
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...