berban / findclick Goto Github PK
View Code? Open in Web Editor NEWFindClick() - ImageSearch, Clicking, & More for AutoHotkey
License: MIT License
FindClick() - ImageSearch, Clicking, & More for AutoHotkey
License: MIT License
If I hover my mouse pointer to a region that will change the color of the that region when I'm using FindClick Screenshot Creator. The screenshot will not exact the same as what I want to be searched. Is there any way to freeze the screen and take the screenshot using FindClick Screenshot Creator?
003: # := " "
003: $ := "
"
002: {
1603: Exit (8.08)
Press [F5] to refresh.
While testing this script I found out that everytime I call FindClick to search for an image CoordMode for Pixel and Mouse is being set to "Screen". Any command regarding Pixel and Mouse (for example PixelGetColor or MouseMove) that activates after the image search treats their coordinate mode as "Screen" for obtaining a pixel or moving the mouse, rather than "Relative" (which is usually the default) or any previously set CoordMode option, like "Client".
I made two short examples using MouseMove and PixelGetColor:
#SingleInstance, Force
#Include <FindClick>
CoordMode, Mouse, Client
Run, Notepad.exe
Sleep, 2000
MouseMove, 100, 100
Sleep, 2000
FindClick("\Test.png", "n")
;CoordMode, Mouse, Client
MouseMove, 200, 200
Return
In the above example CoordMode is set to Client before FindClick. Notepad is activated (and is automatically the active window) and MouseMove moves the mouse successfully to x100 y100 within notepad's window client. Though, when FindClick is called and the mouse is moved again I would've expected it to move to x200 y200 in notepad's window client but instead it moves to x200 y200 of my screen's coordinates.
For the mouse to actually move to x200 y200 within notepad either CoordMode has to be set to Client again after FindClick (as is shown in code) or FindClick needs to be removed. This will indeed result in the mouse moving to x200 y200 within notepad rather than my screen.
MouseMove can be replaced by Click and it goes the same way.
#SingleInstance, Force
#Include <FindClick>
CoordMode, Pixel, Client
Run, Notepad.exe
Sleep, 200
PixelGetColor, Color, 100, 100, RGB
Sleep, 200
FindClick("\Test.png", "n")
;CoordMode, Pixel, Client
PixelGetColor, Color2, 200, 200, RGB
MsgBox, PixelGetColor 1: %Color%`nPixelGetColor 2: %Color2%`n(after FindClick)
Return
The above example is very much like the MouseMove example. Again notepad is activated and PixelGetColor successfully retrieves the color at x100 y100 within notepad's window client (0xFFFFFF). Though again, after FindClick PixelGetColor no longer searches for the color at x200 y200 within notepad but at x200 y200 of my screen, which does not result in 0xFFFFFF, which it should've been had it retrieved the color within notepad.
This can again be made working by either setting CoordMode back to Client or removing FindClick which will result in both PixelGetColor successfully retrieving the color from notepad's window client (2x 0xFFFFFF).
I tried both of the above examples out with "Relative" instead of "Client" as well and the same problem occurs.
Can you tell me if this is actually something that shouldn't happen or that I'm maybe just doing something wrong?
Hey berban, the method worked perfectly! Just a small bug in the code tho, when the WinTitle is passed in, the script also attaches a ahk_id
along with it,
so
ControlClick, x922 y513, ahk_id Girls, , Left, , NA
is being ran instead of
ControlClick, x922 y513, Girls, , Left, , NA
This also happends when you use a Unique ID in the 'r' parameter
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.