hotkeys sometimes don't work

Get help with using AutoHotkey (v1.1 and older) and its commands and hotkeys
agreyfield91
Posts: 5
Joined: 18 Jan 2019, 16:21

hotkeys sometimes don't work

18 Jan 2019, 16:31

I have the following script to switch my windows key and alt key:

Code: Select all

#NoEnv  ; Recommended for performance and compatibility with future AutoHotkey releases.
; #Warn  ; Enable warnings to assist with detecting common errors.
SendMode Input  ; Recommended for new scripts due to its superior speed and reliability.
SetWorkingDir %A_ScriptDir%  ; Ensures a consistent starting directory.

#UseHook

#InstallKeybdHook
SetTitleMatchMode 2
SendMode Input

LAlt::LWin
LWin::LAlt

return
My problem is, when I try to alt-tab with my new hotkey using win-tab, sometimes it doesn't work. I notice this especially when I try to alt-tab after not using the hotkey for awhile - it will only register the tab.

Why is this? I got #UseHook from another post, but it didn't help. If the answer to this has already been posted somewhere, please let me know where to go.
mast4rwang
Posts: 141
Joined: 19 Jul 2017, 09:59

Re: hotkeys sometimes don't work

18 Jan 2019, 16:50

What is the purpose of using hook commands in your script?
agreyfield91
Posts: 5
Joined: 18 Jan 2019, 16:21

Re: hotkeys sometimes don't work

18 Jan 2019, 16:53

I'm not sure - I'm new to ahk, so followed what others did. Is that causing the issue?
User avatar
Scr1pter
Posts: 1277
Joined: 06 Aug 2017, 08:21
Location: Germany

Re: hotkeys sometimes don't work

18 Jan 2019, 18:50

I don't really understand the sense of your code.
You either remap it, or you don't.

Remove LAlt::LWin if you want your lwin key to behave like LAlt.

Cheers!
Please use [code][/code] when posting code!
Keyboard: Logitech G PRO - Mouse: Logitech G502 LS - OS: Windows 10 Pro 64 Bit - AHK version: 1.1.33.09
agreyfield91
Posts: 5
Joined: 18 Jan 2019, 16:21

Re: hotkeys sometimes don't work

18 Jan 2019, 19:54

Wouldn't I be just left with two keys with the same functionality then? I'm trying to swap their actions.

Return to “Ask for Help (v1)”

Who is online

Users browsing this forum: Bing [Bot], CoffeeChaton and 190 guests