help with key combination condition

Get help with using AutoHotkey and its commands and hotkeys
kheerand
Posts: 2
Joined: 11 Jun 2018, 06:03

help with key combination condition

11 Jun 2018, 06:16

Hi folks,

Somewhat of a newbie to AHK. I am trying to have the key combination of ^J followed by another key to take some action in a software application that I commonly use. The code I've got is,

Code: [Select all] [Expand] [Download] GeSHi © Codebox Plus



While this works for the key combination of ^j + 2 or ^j + k, it doesn't work for ^j + ^j. What am I doing wrong here?

Thank you in advance.

Regards
Kheeran
swagfag
Posts: 849
Joined: 11 Jan 2017, 17:59

Re: help with key combination condition

11 Jun 2018, 06:54

yeah idk if id necessarily use an input box for this:

Code: [Select all] [Expand] [Download] GeSHi © Codebox Plus

kheerand
Posts: 2
Joined: 11 Jun 2018, 06:03

Re: help with key combination condition

17 Jun 2018, 09:56

Thanks for you script swagfag. It didn't quite work. It still didn't caputure ^J + ^J and execute the send command. :(
User avatar
Cerberus
Posts: 90
Joined: 12 Jan 2016, 15:46

Re: help with key combination condition

17 Jun 2018, 20:48

The problem is that the second parameter after the Input command, the output variable (the parameter command, in your script), only outputs characters, not hotkeys that don't produce a (visible?) character. And ^j does not produce a character, it's just a hotkey. From the documentation:
OutputVar does not store keystrokes per se. Instead, it stores characters produced by keystrokes according to the active window's keyboard layout/language. Consequently, keystrokes that do not produce characters (such as PageUp and Home) are not stored (though they can be recognized via the EndKeys parameter below).


The proper command to use in your script would probably be the Hotkey command, to create temporary hotkeys, rather than the Input command. But it can still be done with the Input command if you use A_ThisHotkey instead of the output variable. This works for me:

Code: [Select all] [Expand] [Download] GeSHi © Codebox Plus



I've also added the option M to the Input command, or it didn't work. Lastly, I've corrected an error in your code: T5 is an option just like L1 and M, and all options are one parameter together, so there shouldn't be a comma between any of them.

(I've also flagged this post to be moved to the "Ask for Help" forum.)
Last edited by Cerberus on 18 Jun 2018, 19:29, edited 1 time in total.
swagfag
Posts: 849
Joined: 11 Jan 2017, 17:59

Re: help with key combination condition

18 Jun 2018, 15:50

kheerand wrote:It didn't quite work. It still didn't caputure ^J + ^J and execute the send command. :(

it works for ^j + ^j

Return to “Ask For Help”

Who is online

Users browsing this forum: redrum and 75 guests