Only Render/Show GUI if key held down longer than 2 seconds

Get help with using AutoHotkey (v1.1 and older) and its commands and hotkeys
techmon
Posts: 54
Joined: 16 May 2017, 13:30

Only Render/Show GUI if key held down longer than 2 seconds

07 Dec 2021, 16:35

I like this AltTab windows switcher enhancement script that I found on GitHub.
https://github.com/ralesi/alttab.ahk
Thanks to the developer of this script. :)
http://www.autohotkey.com/forum/viewtopic.php?t=6422

Would someone be willing to help tweak it so that it will not try to render / show the black GUI window switcher if Alt Tab is pressed/released quickly...
and if Alt Tab is held, say more than 2 seconds, to show the GUI / normal behavior of script.

The reason for this - with the # of windows I have opened, the rendering of the GUI is slower than I desire... so for a quick Alt Tab, I'd like it to simply do the action of switching windows but without rending the GUI.

Many thanks!
User avatar
Xtra
Posts: 2750
Joined: 02 Oct 2015, 12:15

Re: Only Render/Show GUI if key held down longer than 2 seconds

07 Dec 2021, 19:42

Use KeyWait with a timeout and check errorlevel.
techmon
Posts: 54
Joined: 16 May 2017, 13:30

Re: Only Render/Show GUI if key held down longer than 2 seconds

08 Dec 2021, 10:34

Use KeyWait with a timeout and check errorlevel.
Thanks for your suggestion / reply, Xtra.

I'm not sure how I would actually implement that in the script and it's syntax.

I'm guessing somewhere in the Alt_Tab_Common_Function(dir) ; dir = "Alt_Tab" or "Alt_Shift_Tab" section at line 239.

Right above that, at line 229 of the AutoHotKey file, there is:

Code: Select all

Alt_Tab: ; alt-tab hotkey
  ; Tooltip % time("Alt_Tab_Common_Function", 1)
  Alt_Tab_Common_Function(1)
  Return
Do you see where? (If not, no obligation to check/help ... I realize it's a large script; so maybe it's not obvious / simple to implement.)
techmon
Posts: 54
Joined: 16 May 2017, 13:30

Re: Only Render/Show GUI if key held down longer than 2 seconds

13 Dec 2021, 11:04

OK, I got some help on this and now the script is working as I desire in regards to the GUI not showing up until holding down Tab for 2 seconds.

https://github.com/techmonpiano/alttab.ahk/blob/master/AltTab.ahk

However, I'm having an issue.
it works for awhile, but eventually stops working... (where AltTab will no longer trigger the script.. unless I force close the AutoHotKey process and relaunch the script).

I'm wondering if a key is being held down / causing it to not work...

Is there a AutoHotKey script to run to find any keys that are in the "down" position?

or is there a way to add logging to be able to troubleshoot if something in the script is not completing successfully when it stops working / logging to troubleshoot?

Many thanks!

Return to “Ask for Help (v1)”

Who is online

Users browsing this forum: dipahk, Nerafius, RandomBoy and 166 guests