Jump to content

pixel search, questions first use


Recommended Posts

hi guys  , i try to use pixelsearch for first time i have created a script for delimited  area ,for search , i want search a  gray  pixel color , #464F57  inside at this page web ,https://www.casa.it/vendita-residenziale/in-lucca/mappa-1

in practical  when i select  a left ad and point over map becomes gray i want match

this is a script

#include <GUIConstants.au3>
#include <WindowsConstants.au3>

HotKeySet("{ESC}", "_Bye")
HotKeySet("{SPACE}", "_FERMA")
HotKeySet("{+}", "_ZoomPiu")
HotKeySet("{-}", "_ZoomMeno")
HotKeySet("!q", "_Quadrato")
HotKeySet("!c", "_Cerchio")

Global $iGFerma = 0, $iGCtrlFerma = 0, $iGQuadrato = 0, $iGCerchio = 0, $lokasi

Global $iCircleR = 150 ; <=== Edit this for different circle radius (in pixels)
$iCircleD = $iCircleR * 2

$pt = MouseGetPos()
Global $GUI = GUICreate("test", $iCircleD, $iCircleD, $pt[0] - $iCircleR, $pt[1] - $iCircleR, $WS_POPUP, $WS_EX_TOPMOST)
GUISetBkColor(0xFF0000)

;Global $a = _CreateRoundRectRgn(0, 0, $iCircleD, $iCircleD, $iCircleD, $iCircleD)
Global $a = _CreateRoundRectRgn(0, 0, $iCircleD, $iCircleD, $iCircleD, $iCircleD)
Global $b = _CreateRoundRectRgn(4, 4, ($iCircleD - 8), ($iCircleD - 8), ($iCircleD - 4), ($iCircleD - 4))

_CombineRgn($a, $b)
_SetWindowRgn($GUI, $a)

GUISetState()
GUISetState(@SW_DISABLE)

While 1
    Sleep(10)
    If $iGFerma = 0 Then
        $pt = MouseGetPos()
        If Not @error Then WinMove($GUI, "", $pt[0] - $iCircleR, $pt[1] - $iCircleR)
    Else
        $lokasi = PixelSearch( $iCircleD, $iCircleD, $pt[0] - $iCircleR, $pt[1] - $iCircleR, 0x464F57)
        If IsArray($lokasi) Then
            MsgBox(0,'','trovato gray')
            MouseMove($lokasi[0], $lokasi[1], 0)
        EndIf
    EndIf

WEnd

Func _Quadrato()

    $iGQuadrato = 1

    $a = _CreateRoundRectRgn(0, 0, $iCircleD, $iCircleD, 0, 0)
    $b = _CreateRoundRectRgn(4, 4, ($iCircleD - 8), ($iCircleD - 8), 0, 0)

    _CombineRgn($a, $b)
    _SetWindowRgn($GUI, $a)
EndFunc   ;==>_Quadrato

Func _Cerchio()
    $iGQuadrato = 0

    $a = _CreateRoundRectRgn(0, 0, $iCircleD, $iCircleD, $iCircleD, $iCircleD)
    $b = _CreateRoundRectRgn(4, 4, ($iCircleD - 8), ($iCircleD - 8), ($iCircleD - 4), ($iCircleD - 4))

    _CombineRgn($a, $b)
    _SetWindowRgn($GUI, $a)
EndFunc   ;==>_Cerchio

Func _ZoomPiu()
    $iCircleD += 5
    If $iGQuadrato = 1 Then
        $a = _CreateRoundRectRgn(0, 0, $iCircleD, $iCircleD, 0, 0)
        $b = _CreateRoundRectRgn(4, 4, ($iCircleD - 8), ($iCircleD - 8), 0, 0)
        _CombineRgn($a, $b)
        _SetWindowRgn($GUI, $a)
    Else
        $a = _CreateRoundRectRgn(0, 0, $iCircleD, $iCircleD, $iCircleD, $iCircleD)
        $b = _CreateRoundRectRgn(4, 4, ($iCircleD - 8), ($iCircleD - 8), ($iCircleD - 4), ($iCircleD - 4))
        _CombineRgn($a, $b)
        _SetWindowRgn($GUI, $a)
    EndIf

EndFunc   ;==>_ZoomPiu



Func _ZoomMeno()

    $iCircleD -= 5
    If $iGQuadrato = 1 Then
        $a = _CreateRoundRectRgn(0, 0, $iCircleD, $iCircleD, 0, 0)
        $b = _CreateRoundRectRgn(4, 4, ($iCircleD - 8), ($iCircleD - 8), 0, 0)
        _CombineRgn($a, $b)
        _SetWindowRgn($GUI, $a)
    Else
        $a = _CreateRoundRectRgn(0, 0, $iCircleD, $iCircleD, $iCircleD, $iCircleD)
        $b = _CreateRoundRectRgn(4, 4, ($iCircleD - 8), ($iCircleD - 8), ($iCircleD - 4), ($iCircleD - 4))
        _CombineRgn($a, $b)
        _SetWindowRgn($GUI, $a)
    EndIf

EndFunc   ;==>_ZoomMeno


Func _FERMA()
    If $iGCtrlFerma = 0 Then
        $iGCtrlFerma = 1
        $iGFerma = 1
    Else
        $iGCtrlFerma = 0
        $iGFerma = 0
    EndIf
EndFunc   ;==>_FERMA


Func _CreateRoundRectRgn($l, $t, $w, $h, $e1, $e2)
    $ret = DllCall("gdi32.dll", "long", "CreateRoundRectRgn", "long", $l, "long", $t, "long", $l + $w, "long", $t + $h, "long", $e1, "long", $e2)
    Return $ret[0]
EndFunc   ;==>_CreateRoundRectRgn

Func _CombineRgn(ByRef $rgn1, ByRef $rgn2)
    DllCall("gdi32.dll", "long", "CombineRgn", "long", $rgn1, "long", $rgn1, "long", $rgn2, "int", 3)
EndFunc   ;==>_CombineRgn

Func _SetWindowRgn($h_win, $rgn)
    DllCall("user32.dll", "long", "SetWindowRgn", "hwnd", $h_win, "long", $rgn, "int", 1)
EndFunc   ;==>_SetWindowRgn

Func _bye()
    Exit
EndFunc   ;==>_bye

but not work someone can help me?? thankz

 

Edited by faustf
Link to comment
Share on other sites

  • 4 weeks later...

Help me understand how it's supposed to work, is it supposed to detect the pixel inside the red circle around the mouse cursor or the whole page?

Spoiler

Renamer - Rename files and folders, remove portions of text from the filename etc.

GPO Tool - Export/Import Group policy settings.

MirrorDir - Synchronize/Backup/Mirror Folders

BeatsPlayer - Music player.

Params Tool - Right click an exe to see it's parameters or execute them.

String Trigger - Triggers pasting text or applications or internet links on specific strings.

Inconspicuous - Hide files in plain sight, not fully encrypted.

Regedit Control - Registry browsing history, quickly jump into any saved key.

Time4Shutdown - Write the time for shutdown in minutes.

Power Profiles Tool - Set a profile as active, delete, duplicate, export and import.

Finished Task Shutdown - Shuts down pc when specified window/Wndl/process closes.

NetworkSpeedShutdown - Shuts down pc if download speed goes under "X" Kb/s.

IUIAutomation - Topic with framework and examples

Au3Record.exe

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...