Pressing a key at pixel color change

Get help with using AutoHotkey (v2 or newer) and its commands and hotkeys
EMPEthan
Posts: 1
Joined: 28 May 2023, 04:58

Pressing a key at pixel color change

28 May 2023, 05:05

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
User avatar
mikeyww
Posts: 27372
Joined: 09 Sep 2014, 18:38

Re: Pressing a key at pixel color change

28 May 2023, 07:25

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

Return to “Ask for Help (v2)”

Who is online

Users browsing this forum: No registered users and 98 guests