 |
AutoHotkey Community Let's help each other out
|
| View previous topic :: View next topic |
| Author |
Message |
RG
Joined: 09 Feb 2005 Posts: 17 Location: United States
|
Posted: Tue Oct 25, 2005 10:02 pm Post subject: Using the * modifier, sending original key sequence |
|
|
Hello. On the last macro I wrote (Mouse Jog Buttons, http://www.autohotkey.com/forum/viewtopic.php?t=6002) I use the * modifier before the key name, as in $*Left:: to accept all variations of the Left key (Alt-Left, Alt-Shift-Left, Ctl-alt-left, etc...).
I set up my script so that if Scroll Lock is turned OFF, the actual keystroke should be passed on to the application, instead of the special function.
So, when using the * modifier to allow a hotkey definition to accept all variations of the hotkey, HOW can I determine the actual keystroke that was pressed (as in alt-left, ctl-shift-left, etc...) and send THAT on to the application? Is there a variable somewhere that stores the actual keystrokes which caused the macro to fire? This would be a GREAT feature if it doesn't already exist.
Thanks for any help in this matter!!! If I don't make sense, please ask for clarification.
In a nutshell, what I need to know is:
HOW can I determine the exact sequence of keys which were pressed which caused the macro to run? _________________ RG |
|
| Back to top |
|
 |
Laszlo
Joined: 14 Feb 2005 Posts: 4710 Location: Boulder, CO
|
Posted: Wed Oct 26, 2005 3:21 am Post subject: |
|
|
| check GetKeyState for each modifier key you need |
|
| Back to top |
|
 |
RG
Joined: 09 Feb 2005 Posts: 17 Location: United States
|
Posted: Wed Oct 26, 2005 1:05 pm Post subject: ... |
|
|
So there is no way to say something like
Send,KeySequence
where KeySequence is a variable containing the entire key sequence that caused the macro to fire?
I actually have to test each modifier to determine if it's been held down? _________________ RG |
|
| Back to top |
|
 |
Laszlo
Joined: 14 Feb 2005 Posts: 4710 Location: Boulder, CO
|
Posted: Wed Oct 26, 2005 2:51 pm Post subject: |
|
|
Another alternative is to define a hotkey for each combination of modifiers. This is tedious, but can be automated as below. The A_ThisHotKey variable then shows the hotkey fired with the actual set of modifiers. If you want to distinguish left- an right- modifiers, replace the corresponding entry in the Modifiers list with its two variants, like instead of "!" use "<!,>!". | Code: | Modifiers = #,!,^,+
StringSplit M, Modifiers, `,
Loop % 2**M0
{
i := A_Index-1
j = 1
HK = $
Loop %M0%
{
If (i & j > 0)
HK := HK . M%A_Index%
j += j
}
HotKey %HK%Left, Lefts
}
Return
Lefts:
MsgBox %A_ThisHotKey%
Return | If you want to Send the hotkey, you have to StringReplace...Left,{Left} |
|
| Back to top |
|
 |
Chris Site Admin
Joined: 02 Mar 2004 Posts: 10716
|
Posted: Wed Oct 26, 2005 5:38 pm Post subject: |
|
|
| Also (although I'm not sure if it would help in this case), you might look into Send {Blind}, which avoids releasing Alt/Control/Shift/Win if they started out in the down position. For example, the hotkey *LButton::Send {Blind}RButton would send a right-click in place of each left-click, and it would retain the same modifiers that the user is holding down. |
|
| Back to top |
|
 |
|
|
You can post new topics in this forum You can reply to topics in this forum
|
Powered by phpBB © 2001, 2005 phpBB Group
|