Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

AHK sending a key held in a variable "down"

Tags:

autohotkey

I want to send a key which is held in a variable down. The reason it is held in a variable is because I use a gui for the user to input the key in question.

Currently this works:

Send %hotkey%

But this doesn't:

Send {%hotkey% down}

How can I make this work properly?

like image 435
Paul Chambers Avatar asked Oct 19 '22 22:10

Paul Chambers


1 Answers

Try this code:

Version 1:

hotkey := "n"
Send {%hotkey% down}

Version 2:

!^z::
    hotkey := "n"
    Send {%hotkey% down}
return

Make sure that n is enclosed in "". Enclosing any text with "" means that you are assigning it as a text string. And variable used in a Send command should contain a text string.

like image 75
vasili111 Avatar answered Jan 04 '23 05:01

vasili111