Jump to content

Pixel search in defined area inside defined app


Recommended Posts

Okay, I know it's simple but i cant get it work. I want to do some pixel search function for defined area in defined application. Application that I need to get it work is Bluestack.

2uMhgW5.jpg

Blue rectangle is the app (and it position sometimes get moved) -> I get the position using ControlGetPos

now I only want to pixel search only in red rectangle inside the app. position of red rectangle is 307,628,355,675 based on window info with windows coordinat mode.

HotKeySet("{F2}", "mulai")
HotKeySet("{F3}", "berhenti")

Global $lokasi[2]
Global $warna
Global $penghitung
Global $nyala
Global $title = "BlueStacks App Player"
Global $hwnd = WinGetHandle($title)
Global $BSpos

Func berhenti()
    Exit
EndFunc   ;==>berhenti

Func getPos()
    $aPos = ControlGetPos($title, "", "[CLASS:BlueStacksApp; INSTANCE:1]")
    $tPoint = DllStructCreate("int X;int Y")
    DllStructSetData($tPoint, "X", $aPos[0])
    DllStructSetData($tPoint, "Y", $aPos[1])
    _WinAPI_ClientToScreen(WinGetHandle(WinGetTitle($title)), $tPoint)

    $BSpos[0] = DllStructGetData($tPoint, "X")
    $BSpos[1] = DllStructGetData($tPoint, "Y")
EndFunc   ;==>getPos

Func mulai()
    $nyala = 1
    While $nyala = 1
        $pos = WinGetPos($hwnd)

        WinActivate($hwnd)
        $lokasi = PixelSearch($BSpos[0] , $BSpos[1], $BSpos[0] + $BSpos[2], $BSpos[1] + $BSpos[3], 0x0185B3)
        MouseMove($lokasi[0], $lokasi[1], 0)
        Sleep(200)
        If @error Then
            $penghitung = $penghitung + 1
        EndIf
        If $penghitung > 5 Then
            $nyala = 0
        EndIf
    WEnd
EndFunc   ;==>mulai

While 1
    Sleep(200)
WEnd

But It's not working, please help. Thanks in advance

Edited by mikahoy045
Link to comment
Share on other sites

I have no idea what the relevance of the above question is other than a trap, so bear in mind the forum rules before and if you decide to answer it.

You should use some form of imagesearch to find the position and dimensions of the app icon, because to AutoIt everything in bluestacks is the same control.

Edited by Rockerfeller
Link to comment
Share on other sites

  • Developers

I have no idea what the relevance of the above question is other than a trap, so bear in mind the forum rules before and if you decide to answer it.

You should use some form of imagesearch to find the position and dimensions of the app icon, because to AutoIt everything in bluestacks is the same control.

..and your interest in posting this is what? Maybe you should have PM'ed that, so let's not do this again.

I am going to close this topic until the OP can convince me otherwise.

*click*

SciTE4AutoIt3 Full installer Download page   - Beta files       Read before posting     How to post scriptsource   Forum etiquette  Forum Rules 
 
Live for the present,
Dream of the future,
Learn from the past.
  :)

Link to comment
Share on other sites

  • Jos locked this topic
Guest
This topic is now closed to further replies.
 Share

  • Recently Browsing   0 members

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