AutoHotkey Community

It is currently May 27th, 2012, 3:26 am

All times are UTC [ DST ]




Post new topic Reply to topic  [ 5 posts ] 
Author Message
PostPosted: October 25th, 2005, 11:02 pm 
Offline

Joined: February 9th, 2005, 9:18 pm
Posts: 17
Location: United States
Hello. On the last macro I wrote (Mouse Jog Buttons, http://www.autohotkey.com/forum/viewtopic.php?t=6002&highlight=) 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


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: October 26th, 2005, 4:21 am 
Offline

Joined: February 14th, 2005, 4:05 pm
Posts: 4710
Location: Boulder, CO
check GetKeyState for each modifier key you need


Report this post
Top
 Profile  
Reply with quote  
 Post subject: ...
PostPosted: October 26th, 2005, 2:05 pm 
Offline

Joined: February 9th, 2005, 9:18 pm
Posts: 17
Location: United States
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


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: October 26th, 2005, 3:51 pm 
Offline

Joined: February 14th, 2005, 4:05 pm
Posts: 4710
Location: Boulder, CO
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}


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: October 26th, 2005, 6:38 pm 
Offline

Joined: March 2nd, 2004, 3:36 pm
Posts: 10720
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.


Report this post
Top
 Profile  
Reply with quote  
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 5 posts ] 

All times are UTC [ DST ]


Who is online

Users browsing this forum: rbrtryn and 14 guests


You can post new topics in this forum
You can reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Powered by phpBB® Forum Software © phpBB Group