Dota 2 remap key

Ask gaming related questions (AHK v1.1 and older)
tajni
Posts: 2
Joined: 11 Apr 2021, 00:41

Dota 2 remap key

Post by tajni » 11 Apr 2021, 00:45

Hello.

I want to remap alt key for shift and vice versa. I stumbled upon a code on reddit but I cannot seem to get it to work but it would be exactly what I need. Just swap shift for alt and alt for shift inside the dota 2 client and not outside.

Code: Select all

SetTitleMatchMode , 2						; exact matching, maybe unnecessary but idgaf
#IfWinActive , ahk_class Valve001			; current ahk_class for Dota 2 window

LShift::LAlt
LAlt::Shift
What is ahk_class?
And is the rest of this right?
Last edited by gregster on 11 Apr 2021, 04:45, edited 1 time in total.
Reason: Topic moved to 'Ask For Help > Gaming' (from "Scripts and Functions > ...")
gregster
Posts: 9064
Joined: 30 Sep 2013, 06:48

Re: Dota 2 remap key

Post by gregster » 11 Apr 2021, 04:41

tajni wrote:
11 Apr 2021, 00:45
Hello.

I want to remap alt key for shift and vice versa. I stumbled upon a code on reddit but I cannot seem to get it to work but it would be exactly what I need. Just swap shift for alt and alt for shift inside the dota 2 client and not outside.

Code: Select all

SetTitleMatchMode , 2						; exact matching, maybe unnecessary but idgaf
#IfWinActive , ahk_class Valve001			; current ahk_class for Dota 2 window

LShift::LAlt
LAlt::Shift
What is ahk_class?
And is the rest of this right?
The ahk_class of a window is one way to identify a certain window (class), in order to create window-specific code.
You can determine the ahk_class of a target window by using the Window Spy script included with AHK.

The code above looks like it could work - if the ahk_class is correct. (Currently it is remapping the left shift key to the left alt key, and the left alt key to shift generally).
You could start by temporarily removing the line #IfWinActive , ahk_class Valve001 and see if the remappings generally work in the game - if yes, add the line again, ideally after checking if the ahk_class is correct.

(Sorry, I can't check for you, since I don't have the game - never even played it.)
tajni
Posts: 2
Joined: 11 Apr 2021, 00:41

Re: Dota 2 remap key

Post by tajni » 11 Apr 2021, 05:48

Thank you. That helps a lot anyway :)
Post Reply

Return to “Gaming Help (v1)”