Help with Multi-Key scripts.

Get help with using AutoHotkey and its commands and hotkeys
proactivematter
Posts: 3
Joined: 24 Jan 2021, 14:38

Help with Multi-Key scripts.

Post by proactivematter » 24 Jan 2021, 15:00

Hello!

I've spent a couple of hours trying to figure this out, but it is beyond me. I'm looking to set up a couple of scripts:

Press LWin+LShift+1 and have that be interpreted as LCtrl+LShift+LAlt+\.

Press F17 and have that launch an app.

Press Enter and have that allow me to rename a file (only when in Explorer)

Press Ctrl+O and have that open a file (only in Explorer)

Appreciate anyone willing to help! I bet if I have the base for these scripts I'll be able to copy and modify them for the other things I'll be needing.

Thank you.
User avatar
mikeyww
Posts: 5347
Joined: 09 Sep 2014, 18:38

Re: Help with Multi-Key scripts.

Post by mikeyww » 24 Jan 2021, 15:19

Code: Select all

#<+1::Send {LCtrl down}{LShift down}{LAlt down}\{LAlt up}{LShift up}{LCtrl up}
F17::Run, fullpathtoapp

#IfWinActive ahk_exe explorer.exe
$Enter::
ControlGetFocus, fcontrol, A
Send % Instr(fcontrol, "DirectUI") ? "{F2}" : "{Enter}"
Return
^o::Enter
proactivematter
Posts: 3
Joined: 24 Jan 2021, 14:38

Re: Help with Multi-Key scripts.

Post by proactivematter » 25 Jan 2021, 23:01

Hey Mikey, thank you so much for the script!

This is already really helpful, however I was wondering if you'd be up for helping me resolve a few issues / refine it?

When I press LWin+LShift+1 I am getting the windows default behavior instead of the alternate shortcut. Currently pressing LWin+LShift+1 opens the first item in my start menu.

For opening files with Ctrl+O, it opens up a new window every time, which is what would happen if I pressed Ctrl+Enter. What I would like is to keep the behavior as if I had just pressed enter, if possible, so that I may navigate folders without opening multiple windows.

Lastly, this isn't a big issue really, but is there a way for Enter to rename files in explorer AND the desktop? I thought the desktop was part of explorer, but it doesn't seem to work there.

Thanks again.
User avatar
mikeyww
Posts: 5347
Joined: 09 Sep 2014, 18:38

Re: Help with Multi-Key scripts.

Post by mikeyww » 26 Jan 2021, 00:57

This might help with some of the issues. I am not sure what the alternate shortcut is supposed to do.

Code: Select all

#<+1::SendInput {LCtrl down}{LShift down}{LAlt down}\{LAlt up}{LShift up}{LCtrl up}
F17::Run, fullpathtoapp

#IfWinActive ahk_exe explorer.exe
$Enter::
ControlGetFocus, fcontrol, A
Send % fcontrol ~= "DirectUI|SysListView" ? "{F2}" : "{Enter}"
Return
$^o::Enter
proactivematter
Posts: 3
Joined: 24 Jan 2021, 14:38

Re: Help with Multi-Key scripts.

Post by proactivematter » 26 Jan 2021, 13:00

Hey Mikey,

So I just discovered Microsoft PowerToys and was able to disable that Windows default shortcut in order to get this alternate one working. The reason I need that alternate shortcut is to achieve mapping parity between this system and a Mac, the issue being that one of my applications did not allow the shortcut to be mapped in such parity on this Windows system due to that particular app having shortcut key selection limitations. Anyway, this part is solved!

But Ctrl+O continues to open new explorer windows when I try to open a folder in an existing window.

With PowerToys I am able to remap Ctrl+O to Enter, and in that way it behaves correctly, but then for some reason the Enter::F2 script will not function in conjunction to this configuration. PowerToys is also limited in the sense that I cannot remap single key substitutions such as Enter::F2 and have it activate only for explorer, so I cannot solve that requirement through PowerToys. Peculiarly, it is possible to remap multi-key shortcuts and have that be exclusive to explorer, which is why mapping Ctrl+O to Enter in PowerToys would be a feasible option were it not for the fact it does not seem to work in conjunction with the Enter::F2 script. So it does seem that both these functions would need to be realized through AHK.

Thanks again for your continued help!!
Attachments
Screenshot_2.jpg
Screenshot_2.jpg (229.32 KiB) Viewed 50 times
User avatar
mikeyww
Posts: 5347
Joined: 09 Sep 2014, 18:38

Re: Help with Multi-Key scripts.

Post by mikeyww » 26 Jan 2021, 13:16

Hmm. OK. Sorry I was not able to help. Others might have solutions for you here. Best wishes.
Post Reply

Return to “Ask For Help”