Sign in to follow this  
Followers 0
civilcalc

Mouse clicking

8 posts in this topic

#1 ·  Posted (edited)

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

Share this post


Link to post
Share on other sites



hi,

PS I think I have cracked a full autoit OCR script

What do you mean "cracked"?

-smartee

Share this post


Link to post
Share on other sites

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

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

Share this post


Link to post
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)

Share this post


Link to post
Share on other sites

#5 ·  Posted (edited)

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

Share this post


Link to post
Share on other sites

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

_WinAPI_Mouse_Event($MOUSEEVENTF_LEFTDOWN)

I'll take a look, thanks

Share this post


Link to post
Share on other sites

#7 ·  Posted (edited)

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!
¯\_(ツ)_/¯  ٩(●̮̮̃•̃)۶ ٩(-̮̮̃-̃)۶ૐ

Share this post


Link to post
Share on other sites

#8 ·  Posted (edited)

Damn, that is what I was looking for..._IsPressed....arrr

What is the point of the .dll open?

Edited by dufran3

Share this post


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
Sign in to follow this  
Followers 0