Key names without the modifiers?

Discuss the future of the AutoHotkey language
Posts: 4
Joined: 16 Jun 2015, 23:49

Key names without the modifiers?

15 Oct 2020, 23:25

I understand that there's an implicit parameter 'ThisHotKey' that exists on entry to every hotkey routine. Quite often I'm wanting just the key name(s)
from this parameter without the modifiers. So, for example, if ThisHotKey = "$!+LButton" then I often want just "LButton" to use in a command
like " keywait 'LButton' ". If it was a double hotkey like "~RButton & C" then I'd want just 'RButton' and 'C'.

I realise that it's a fairly trivial task to strip these modifiers out, but I was wondering if it would make any sense to have some other
parameter(s) that contain just the key name(s)?
Posts: 4464
Joined: 17 Jul 2016, 01:02

Re: Key names without the modifiers?

24 Oct 2020, 03:03

I don't think it makes sense to add this as a parameter. It would make more sense to change the current parameter to be the hotkey object itself, which could have the desired information accessible through a property. I don't think that is a priority though.

User avatar
Posts: 69
Joined: 06 Dec 2014, 14:27
Facebook: e2c52f
GitHub: RaptorX

Re: Key names without the modifiers?

01 Nov 2020, 07:04

I think you can achieve that with a simple instr() like so:

Code: Select all

if instr(ThisHotkey, "LButton")
if (instr(ThisHotkey, "RButton") && instr(ThisHotkey, "C")) ; check for 2 keys

Return to “AutoHotkey v2 Development”

Who is online

Users browsing this forum: No registered users and 3 guests