Each key/mouse event detection routine as first - possible?

Get help with using AutoHotkey (v1.1 and older) and its commands and hotkeys
MIRKOSOFT
Posts: 334
Joined: 23 Sep 2014, 14:29

Each key/mouse event detection routine as first - possible?

02 Aug 2021, 20:06

Hi!

I need for some actions use some variables to let script know values.

I need any detection routine to run after any:
- key down
- key up
- mouse button down
- mouse button up
- mouse move

and only when it passes test specified key assignments.

Is it by any way possible?
Even to avoid mistakes like script error after same 2nd key use...

Thank you all for each help, reply or comment.

Miro
User avatar
mikeyww
Posts: 26885
Joined: 09 Sep 2014, 18:38

Re: Each key/mouse event detection routine as first - possible?

02 Aug 2021, 20:19

Example:

Code: Select all

keys =
F3::MsgBox, 64, Keys, % SubStr(keys, 2)
~f::
~f Up::
~LButton::
~LButton Up::
keys .= "`n" StrReplace(A_ThisHotkey, "~")
Return
Here is a mouse hook, too.

You can also use Input. See the documentation for a description & examples.
MIRKOSOFT
Posts: 334
Joined: 23 Sep 2014, 14:29

Re: Each key/mouse event detection routine as first - possible?

13 Aug 2021, 17:26

Problem is that it detects only f, f Up, LButton, LButton Up

Or?

I need - in example named "all" what is each key and mouse button and wheel:

Code: Select all

~all::
; do action
; takes action result into variable
; jumps to test assigned keys with variable use
Return
Miro
User avatar
mikeyww
Posts: 26885
Joined: 09 Sep 2014, 18:38

Re: Each key/mouse event detection routine as first - possible?

13 Aug 2021, 17:33

Just my own view is that AHK is not really designed as a key logger per se, but you may be able to adapt the following example in a variety of ways.

https://www.autohotkey.com/docs/commands/Input.htm#ExAnyKey

Return to “Ask for Help (v1)”

Who is online

Users browsing this forum: No registered users and 349 guests