Jump to content

Mouse clicking


Recommended Posts

Hey peeps,

I have an input box for a hex colour, and a button next to the input box for the 'set' function.

I want to click the set button, then click somewhere on the screen and the colour under the cursor be returned for the Guictrlsetdata function to update the input box, but I cannot get it to work at all.

Thanks in advance.

PS I think I have cracked a full autoit OCR script (without external apps or dlls) , all will be revealed here soon!

Edited by civilcalc
Link to comment
Share on other sites

hi,

What do you mean "cracked"?

-smartee

As far as I am aware there isnt currently an autoit OCR script, that doesnt require any 3rd party applications or dlls. I believe I have made one.

Can't you just use this to get the color under the mouse cursor?

$MousePos = MouseGetPos()
$PixelGetColor = Hex(PixelGetColor($MousePos[0], $MousePos[1]),6)

Kind of, but I want that portion of script to occur when I click the mouse.

Ive tried a while guigetmsg() loop, but it always returns 0 (no event)

Link to comment
Share on other sites

As far as I am aware there isnt currently an autoit OCR script, that doesnt require any 3rd party applications or dlls. I believe I have made one.

Kind of, but I want that portion of script to occur when I click the mouse.

Ive tried a while guigetmsg() loop, but it always returns 0 (no event)

Can you use this to try and read for mouse clicks?

_WinAPI_Mouse_Event($MOUSEEVENTF_LEFTDOWN)
Edited by dufran3
Link to comment
Share on other sites

Try this cracker :unsure: :

#include <GUIConstantsEx.au3>
#include <Misc.au3>
#include <StaticConstants.au3>
#include <WindowsConstants.au3>

$hGUI = GUICreate("Get Pixel Color", 289, 61, -1, -1, -1, $WS_EX_TOPMOST)
$Label1 = GUICtrlCreateLabel("Color:", 32, 8, 39, 20, $SS_RIGHT)
GUICtrlSetFont(-1, 10, 400, 0, "MS Sans Serif")
$Label2 = GUICtrlCreateLabel("Position:", 16, 32, 55, 20, $SS_RIGHT)
GUICtrlSetFont(-1, 10, 400, 0, "MS Sans Serif")
$Input1 = GUICtrlCreateInput("Input1", 72, 8, 121, 21)
$Button = GUICtrlCreateButton("Set", 208, 16, 75, 25)
$Input2 = GUICtrlCreateInput("Input2", 72, 32, 121, 21)
GUISetState(@SW_SHOW)
$dll = DllOpen("user32.dll")

While 1
    $nMsg = GUIGetMsg()
    Switch $nMsg
        Case $GUI_EVENT_CLOSE
            DllClose($dll)
            Exit
        Case $Button
            Do
                $aMpos = MouseGetPos()
                $color = PixelGetColor($aMpos[0], $aMpos[1])
                $pos = $aMpos[0] & ", " &  $aMpos[1]
            Until _IsPressed("01")
            GUICtrlSetData($Input1, "0x" & Hex($color, 6))
            GUICtrlSetData($Input2, $pos)
    EndSwitch
WEnd

Br,

UEZ

Edited by UEZ

Please don't send me any personal message and ask for support! I will not reply!

Selection of finest graphical examples at Codepen.io

The own fart smells best!
Her 'sikim hıyar' diyene bir avuç tuz alıp koşma!
¯\_(ツ)_/¯  ٩(●̮̮̃•̃)۶ ٩(-̮̮̃-̃)۶ૐ

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