Trying Contextual HotKeys

Get help with using AutoHotkey (v1.1 and older) and its commands and hotkeys
SicNBP
Posts: 1
Joined: 22 Apr 2021, 03:58

Trying Contextual HotKeys

Post by SicNBP » 22 Apr 2021, 04:13

Hi, I'm very new with AHK, and I have some knowledge problems.
I'm trying to make a srcipt that allows me to have same Hotkeys with diferent Keystrokes depending the context.

f.e.: if I do "D" then sends DI, and after that command the next hotkeys will be "R", "D" and "L", sending RA, CD and LA respectively. After that exit with "Esc" and letting free the hotkeys "R", "D" and "L" for others Keystrokes.

My problem is about theory and syntax.

I've been strarting my code like this:

Code: Select all

WinActivate, ahk_exe Revit.exe

d::
var01 = Dimensions
Send, di

if(var01 = "Dimensions")
{
	l::
	Send, cl

	a::
	Send, ca

	r::
	Send, ra

	i::
	Send, cd

	d::
	Send, la

	var01 = 0
	Return
}
Return


If someone can give me some light about this I'll be very grateful.
User avatar
mikeyww
Posts: 26939
Joined: 09 Sep 2014, 18:38

Re: Trying Contextual HotKeys

Post by mikeyww » 22 Apr 2021, 05:45

Code: Select all

d::var01 := "Dimensions"

#If (var01 = "Dimensions")
l::Send cl
#If
Explained: #If
Post Reply

Return to “Ask for Help (v1)”