Monday, June 29, 2015

Autohotkey, use F1 as prefix key but do NOT block Ctrl+F1, Shift+F1 etc


Using the following statement,


F1 & F9:: Msgbox, Got F1+F9

I can successfully use F1 as a prefix hotkey, quite a useful feature. However, I quickly find that Ctrl+F1, Shift+F1 etc lose their functionality, i.e. application cannot detect them.


I tried to add a tilde,


~F1 & F9:: Msgbox, Got F1+F9

but this always trigger F1 for application before I have the chance to press F9 -- not what I want.


How to achieve the desired result?


BTW: I can totally accept the minor side effect of firing F1, Ctrl+F1 or Shift+F1 when F1 is released.


Autohotkey 1.1.13.1


Answer



I figure it out myself.


F1 & F9:: MsgBox, F1+F9
*F1 up:: Send {Blind}{F1 down}{F1 up}

The {Blind} is important. Without it, pressing Shift+F1 will(may) cause application to get only F1. In my actual case, my application is EmEditor v14, and I have successfully achieve:



  • F1+F9 or F1+F10 to quickly switch between first row tabs.

  • F2+F9 or F2+F10 to quickly switch between second row tabs.

  • F3+F9 or F3+F10 to quickly switch between third row tabs.

  • F4+F9 or F4+F10 to quickly switch between fourth row tabs.

  • use **F5+...* if desired


I do this because EmEditor, although great at many other aspects, does not provide a quick way to switch document tabs by keyboard.


If you're interested, I can post my whole script later, about 30 lines.


No comments:

Post a Comment

linux - How to SSH to ec2 instance in VPC private subnet via NAT server

I have created a VPC in aws with a public subnet and a private subnet. The private subnet does not have direct access to external network. S...