Launch program only when key is released

English support forum

Moderators: Hacker, petermad, Stefan2, white

Post Reply
User avatar
Galizza
Member
Member
Posts: 198
Joined: 2018-09-07, 05:21 UTC

Launch program only when key is released

Post by *Galizza »

 
Hi, sometimes my computer is used by a very elderly person, he knows how to use Tc quiet well, but his hands no longer respond like those of a young person, and his reaction time is very slow.

In practice, when he presses Enter on a file whose extension is associated with a program in [Associations] section or any other Tc shortcut associated with an em_command, it takes him so long to lift his finger that multiple instances of the same program are launched.

Is there a way to prevent this, so that the program or em_command launches only when key is released ? If not, i would appreciate it if something similar could be implemented to be used optionally, since Tc already has options to wait until the key is released, as in the case of
TC help, section 4.b wrote:TabSwitchMode=0
0: Ctrl+Tab switches tabs only when releasing the CTRL key
1: Ctrl+Tab switches tabs immediately when pressing the TAB key.
Perhaps a new command like cm_waitkeyreleased that i can insert at the beginning of affected em_commands.

Thank you very much.
Fla$her
Power Member
Power Member
Posts: 2982
Joined: 2020-01-18, 04:03 UTC

Re: Launch program only when key is released

Post by *Fla$her »

Autorun beta (Installation)
"%COMMANDER_PATH%\Plugins\wdx\Autorun\autorun.cfg:

Code: Select all

LoadLibrary Plugins\Autorun_Tweaks.dll
LoadLibrary Plugins\Autorun_Runtime.dll

SetHotKeyAction /H:ENTER /S Enter

Func Enter
   If WinFind(0, '#32768') Or WinGetFocusedCtrl(AUTORUN_TCHANDLE) <> RequestInfo(3) Or MainMenuFocus() Then Return -1
   SendCommand 1001
EndFunc

Func MainMenuFocus
   Static MBI = Buffer(auPtrSize*4 + 16)
   MBI.Zero()
   MBI.SetNum(0, "int", MBI.Size)
   DllCall("GetMenuBarInfo", "hwnd", ACTIVE_WINDOW, "ulong", 0xFFFFFFFD, "long", 0, "ptr", MBI.Ptr)
   Return BitAND(MBI.GetNum(auPtrSize*3 + 16), 1)
EndFunc
Last edited by Fla$her on 2025-03-15, 12:36 UTC, edited 1 time in total.
Overquoting is evil! 👎
User avatar
white
Power Member
Power Member
Posts: 5744
Joined: 2003-11-19, 08:16 UTC
Location: Netherlands

Re: Launch program only when key is released

Post by *white »

Why not change the Windows keyboard settings for this user?

For example, set the keyboard repeat delay to long and keyboard repeat rate to slow. (run "control keyboard")

Or perhaps even better, use Ease of Access/Accessibility keyboard options:

Via Control Panel:
Run "control access.cpl" and click on "Make the keyboard easier to use" and turn on Filter keys and change the settings if you want to.
(or run "control /name Microsoft.EaseOfAccessCenter")

Via Settings App
Run "ms-settings:easeofaccess-keyboard" and turn on Filter keys and change the settings if you want to.
User avatar
Galizza
Member
Member
Posts: 198
Joined: 2018-09-07, 05:21 UTC

Re: Launch program only when key is released

Post by *Galizza »

2Fla$her & white

Thanks, i will try both solutions.
BTW Autorun plugin looks like a very interesting plugin, is it as good as good as it seems or can it affect the normal functioning of Tc in some way, for example slowing it down?. Thanks :!:
Fla$her
Power Member
Power Member
Posts: 2982
Joined: 2020-01-18, 04:03 UTC

Re: Launch program only when key is released

Post by *Fla$her »

2Galizza
Since the plugin has a scripting basis with the ability to use cyclic and threading operations, then, of course, it can slow down the work with poorly written code, but beginners who cannot yet use it fully, as a rule, are not in danger. For questions about the plugin, you can contact an existing topic.
Clarified the code. I forgot that the function uses the entire TC window, not just the listboxes.
Overquoting is evil! 👎
Post Reply