Page 1 of 1

Pressing a key at pixel color change

Posted: 28 May 2023, 05:05
by EMPEthan
Hi there,

Please help, I'm not very good with coding and it's formatting etc and have just discovered this community and AHK which might be able to help me?

I'm after a simple script that will detect when pixel 1422,658 turns to color BEBEBE (as obtained from window spy) the spacebar will be pressed straight away.
Ideally if possible have it hold the spacebar down for 4seconds then release? after which it can close until being rerun

Thank you very much for your time, and I appreciate any help
Ethan

Re: Pressing a key at pixel color change

Posted: 28 May 2023, 07:25
by mikeyww
Welcome to this AutoHotkey forum!

Code: Select all

#Requires AutoHotkey v2.0
While PixelGetColor(1422, 658) != 0xBEBEBE ; Relative to active window's client area
 Sleep 30
Send('{Space down}'), Sleep(4000), Send('{Space up}')
ExitApp