Jump to content

Sky Slate Blueberry Blackcurrant Watermelon Strawberry Orange Banana Apple Emerald Chocolate
Photo

Workaround for combining 3 keys, e.g. ^ & / & a


  • Please log in to reply
4 replies to this topic
pajenn
  • Members
  • 391 posts
  • Last active: Jul 20 2014 04:06 PM
  • Joined: 07 Feb 2009
Ultimately I'd like to define hotkeys such as
^ & / & a
^ & / & b
^ & / & c ...

but "&" only agrees to combine 2 keys at a time, so I use
RCONTROL & /::[launch script with a,b,c,... defined as hotkeys for 2 sec].

It works, but there has to be a more elegant way to do it??

I want the script to exit after 'anykey' is released, or if it times out, say 5 seconds:

SetTimer, Closer, -2000
return

a::GetMenuItemBySBar("Select")
c::GetMenuItemBySBar("Copy To")
^c::GetMenuItemBySBar("Copy Conetnt")
<snip>
w::GetMenuItemBySBar("Run with Parameters")

Closer:
ExitApp


Details (unimporant, only incl. for completeness):


Parent hotkey command:
RCONTROL & /::Run PickFMtool.ahk
launches PickFMtool.ahk:
SetTimer, Closer, -2000
return

a::GetMenuItemBySBar("Select")
c::GetMenuItemBySBar("Copy To")
^c::GetMenuItemBySBar("Copy Content")
DELETE::GetMenuItemBySBar("Delete and no Move to Recycle Bin")
d::GetMenuItemBySBar("Duplicate Files")
f::GetMenuItemBySBar("Find and Replace")
^f::GetMenuItemBySBar("Create New Folder")
m::GetMenuItemBySBar("Move To")
n::GetMenuItemBySBar("Copy Name")
p::GetMenuItemBySBar("Copy Path")
^p::GetMenuItemBySBar("Pack to Folder")
r::GetMenuItemBySBar("Command Line from Here")
^r::GetMenuItemBySBar("Advanced Renamer")
s::GetMenuItemBySBar("Size of Folders")
^s::GetMenuItemBySBar("Synchronize")
t::GetMenuItemBySBar("Change Time")
^t::GetMenuItemBySBar("Configure FileMenu Tools")
w::GetMenuItemBySBar("Run with Parameters")

Closer:
ExitApp
The GetMenuItemBySBar() function is defined here (4th post):
<!-- m -->http://www.autohotke...pic.php?t=41486<!-- m -->

keybored
  • Members
  • 351 posts
  • Last active: Apr 26 2013 09:08 AM
  • Joined: 18 Jun 2006
Try using the scan code.

SC035^ & B::
msgbox, this works
return


pajenn
  • Members
  • 391 posts
  • Last active: Jul 20 2014 04:06 PM
  • Joined: 07 Feb 2009

Try using the scan code.

SC035^ & B::
msgbox, this works
return


thanks - it works!

Lexikos
  • Administrators
  • 9449 posts
  • Last active:
  • Joined: 17 Oct 2006

so I use
RCONTROL & /::[launch script with a,b,c,... defined as hotkeys for 2 sec].

For future reference, you may wish to look into the Hotkey command. Using that, it becomes unnecessary to launch a separate script...

pajenn
  • Members
  • 391 posts
  • Last active: Jul 20 2014 04:06 PM
  • Joined: 07 Feb 2009
The Hotkey command looks like it certainly has it uses, maybe even to enable/disable the filemenu tools commands.

in any case, the scancode technique works great for combining three keys at least. I used them with my function to pick the menu item by status bar text:

~SC035^ & C::GetMenuItemBySBar("copy Content")
~SC035^ & D::GetMenuItemBySBar("Duplicate files")
~SC035^ & DELETE::GetMenuItemBySBar("DELETE and no move to recycle bin")
~SC035^ & E::GetMenuItemBySBar("sElect")
~SC035^ & F::GetMenuItemBySBar("create new Folder")
~SC035^ & F1::GetMenuItemBySBar("conF1gure filemenu tools")
~SC035^ & F3::GetMenuItemBySBar("F3ind and replace")
~SC035^ & M::GetMenuItemBySBar("Move to")
~SC035^ & N::GetMenuItemBySBar("copy Name")
~SC035^ & P::GetMenuItemBySBar("copy Path")
~SC035^ & K::GetMenuItemBySBar("pacK to folder")
~SC035^ & L::GetMenuItemBySBar("command Line from here")
~SC035^ & R::GetMenuItemBySBar("advanced Renamer")
~SC035^ & S::GetMenuItemBySBar("Size of folders")
~SC035^ & T::GetMenuItemBySBar("change Time")
~SC035^ & W::GetMenuItemBySBar("run With parameters")
~SC035^ & Y::GetMenuItemBySBar("CopY To")
~SC035^ & Z::GetMenuItemBySBar("synchroniZe")

I also discovered the Input command, which has it's advantages and disadvantages. I have it set up so that Ctrl+/ starts a 2 second window during which AHK looks out for the specified 2-letter strings, and takes action accordingly. This way I can use more than 3 keys total, and there's a wait time - you press them consecutively as opposed to simultaneously, which makes it easier to launch hotkeys with one hand, and in my case also to use them with Dragon Naturally Speaking Pro (voice recognition). However, the "Input" keys cannot be modifier or function keys such as F1, F3, or DEL. Here's my script, which I post for reference/example - but it is of course useless as is for anyone other than me:

~^SC035::
Input, fmkey, T2 L2, {esc}, ar, cc, cd, cf, cn, ct, de, df, fr, mm, nn, pk, pp, rw, se, ss, sy, tt
SetKeyDelay, -1  ; -1 = fastest (no delay), 0 = min delay
if fmkey = ar
  GetMenuItemBySBar("Advanced Renamer")
else if fmkey = cc
  GetMenuItemBySBar("Copy Content")
else if fmkey = cd
  GetMenuItemBySBar("CommanD Line from here")
else if fmkey = cf
  GetMenuItemBySBar("ConFigure filemenu tools")
else if fmkey = cn
  GetMenuItemBySBar("Copy Name")
else if fmkey = ct
  GetMenuItemBySBar("Copy To")
else if fmkey = de
  GetMenuItemBySBar("DElete and no move to recycle bin")
else if fmkey = df
  GetMenuItemBySBar("Duplicate Files")
else if fmkey = fr
  GetMenuItemBySBar("Find and Replace")
else if fmkey = mm
  GetMenuItemBySBar("MMove To")
else if fmkey = nn
  GetMenuItemBySBar("create NNew Folder")
else if fmkey = pk
  GetMenuItemBySBar("PacK to folder")
else if fmkey = pp
  GetMenuItemBySBar("copy PPath")
else if fmkey = rw
  GetMenuItemBySBar("Run With parameters")
else if fmkey = se
  GetMenuItemBySBar("SElect")
else if fmkey = ss
  GetMenuItemBySBar("Size of folderS")
else if fmkey = sy
  GetMenuItemBySBar("SYnchronize")
else if fmkey = tt
  GetMenuItemBySBar("change TTime")
return
[/code]