Trying to use PixelSearch and Click Topic is solved

Ask gaming related questions (AHK v1.1 and older)
mvpcc999

Trying to use PixelSearch and Click  Topic is solved

27 Mar 2018, 08:21

Hey guys, I'm posting first time here so sorry if any mistake or broke any rule.
I'm just trying autohotkey first time. Here is my script.

PixelSearch, A, B, 0, 0, A_ScreenWidth, A_ScreenHeight, 0xFFD8FF, 3, Fast
MouseMove, A, B
Click

Nothing much.

So the script is working and click at pixel position but not on other program. I mean it is working on desktop but not clicking on Memu emulator.

Thank you.
gregster
Posts: 9114
Joined: 30 Sep 2013, 06:48

Re: Trying to use PixelSearch and Click

28 Mar 2018, 01:30

Try:

Code: Select all

CoordMode, Pixel, Screen 	; because you want to use the whole screen for the search
PixelSearch, A, B, 0, 0, %A_ScreenWidth%, %A_ScreenHeight%, 0xFFD8FF, 3, Fast
CoordMode, Mouse, Screen
MouseMove, %A%, %B%
Click
Also make sure, that your color is in the right format - here you have to use the Blue-Green-Red (BGR) format - or use the RGB option.
The emulator might run with elevated rights - then run your script as admin... also, many games don't work in fullscreen mode with AHK . perhaps it is the same with this emulator. Try "windowed" mode instead.

Also, this might help: https://autohotkey.com/boards/viewtopic.php?t=11084

edited: The %s are not needed, it seems - these commands accept expressions, too...
S1lver
Posts: 23
Joined: 07 Nov 2020, 04:14

Re: Trying to use PixelSearch and Click

15 Jun 2022, 12:53

hey m8. this didnt work. it says that mousemove needs 2 parametres
gregster
Posts: 9114
Joined: 30 Sep 2013, 06:48

Re: Trying to use PixelSearch and Click

15 Jun 2022, 13:13

S1lver wrote:
15 Jun 2022, 12:53
hey m8. this didnt work. it says that mousemove needs 2 parametres
Well, I count two...
gregster wrote:
28 Mar 2018, 01:30

Code: Select all

MouseMove, %A%, %B%
S1lver
Posts: 23
Joined: 07 Nov 2020, 04:14

Re: Trying to use PixelSearch and Click

15 Jun 2022, 15:03

yeah me to :)
however I have a hard time managing different windows since this moves my mouse. do you know if it is possible that I can use like a Controlclick command with the pixel search. so I can stay in another window, while it does the clicking.
right now I'm using

Code: Select all

IfWinNotActive, Sketchbook, , WinActivate, Sketchbook,  
!Q::reload
!s::
loop,5
{
WinGet, id, ID, Sketchbook,

PixelSearch, X, Y, 2439, 544, 370, 33, 0x18FC00, 0, fast, rgb
if ErrorLevel 
MsgBox Not Found!

Else
controlClick,%x% %y%,SKetchbook,Left
}
if I change

Code: Select all

controlClick,%x% %y%,SKetchbook,Left
with

Code: Select all

Click,%x% %y%,SKetchbook,Left
it works, but I have no control of the mouse
sincerely
gregster
Posts: 9114
Joined: 30 Sep 2013, 06:48

Re: Trying to use PixelSearch and Click

16 Jun 2022, 08:27

Not all programs or games work with ControlClick. That said, your syntax seems off, the parameters don't match the documentation.
You probably need smth like this:

Code: Select all

ControlClick, x%x% y%y%, SKetchbook, , Left  ; or leave the button out since Left is the default anyway
Also the comma between fast and rgb in the Pixelsearch line seems wrong. It's the same parameter - just use a space between them.

PS: Perhaps SKetchbook doesn't hurt in Click,%x% %y%,SKetchbook,Left (and just gets ignored because it doesn't contain letters which match a Click option), but Click doesn't have a WinTitle parameter... it's definitely safer to remove it.
S1lver
Posts: 23
Joined: 07 Nov 2020, 04:14

Re: Trying to use PixelSearch and Click

16 Jun 2022, 13:04

i've also tried using ControlClick, x%x% y%y% it didnt work.
I was not aware that there is certain windows that cannot be supported by ControlClick. perhaps that is all there is to it. Autoit doesn't seem to support it either. since the windows has no Control ID. how sad

Return to “Gaming Help (v1)”

Who is online

Users browsing this forum: No registered users and 100 guests