Sign in to follow this  
Followers 0
YaY/eFF

Problem with locked Win key after script is finished

1 post in this topic

Hello!

I just recently discovered this app, and I must say I am amazed by the possibilities it provides. Anywho, let's get to my problem:

I have a small script that control an internet explorer window. All it does actually is to show the window, if it is hidden and vice versa:

;disable input from mouse and keyboard
BlockInput(1)
;check if window is focused
if WinActive("Webbradio - Sveriges Radio - Microsoft Internet Explorer") Then
;minimize radio window
    WinSetState("Webbradio - Sveriges Radio - Microsoft Internet Explorer", "", @SW_MINIMIZE)
Else
;Focus radio window
    WinActivate("Webbradio - Sveriges Radio - Microsoft Internet Explorer")
EndIf
;enable input from mouse and keyboard
BlockInput(0)
;occasionally win/ctrl key locks after script, this ought to fix that
send("{LWINUP}{RWINUP}{CTRLUP}")

First of all the script blocks all input, not allowing the user to interfere with the script by using the mouse or keyboard. After that comes the main part of the script. Tt checks if the window is active, and if it is, hides it. Otherwise it shows it. Main part of the script is over, and we unblock input.

There is one final row, but let's talk about that i bit later.

I have to mention how this script is run. I am using the shell replacement Litestep (www.litestep.net), hopefully some of you guys have heard of it. Anyway this shell has a builtin hotkey feature which lets the user map hotkeys to starting apps, showing documents, closing apps etc etc. So what I have done is binding a hotkey, more specifically Win+H, to run the script mentioned above.

A lot of talk, let's get to the problem, right? Ok, here goes:

Whenever I run Win+H the window either shows or hides, but the problem is that very often after the script is finished the Win key is stuck in pressed. For instance if I only press H after I have run the script before, the computer thinks I am pressing Win+H and shows/hides the window. The only way to unlock Win key is to press the Win key again.

I first thought I could solve this problem by adding the final row in my script above, but it didn't help at all, the Win key still locks every now and then.

I suspect that it locks when I release the Win key too slowly, and blockInput(1) thereby keeps it pressed. What do you think about that theory?

I also have to mention that this happen with all my other scripts that are mapped to hotkeys, and it also happens when I use ctrl key instead of Win.

Anyone have any ideas for solving this problem? I would greatly appreciate it!

Best regards,

Share this post


Link to post
Share on other sites



Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!


Register a new account

Sign in

Already have an account? Sign in here.


Sign In Now
Sign in to follow this  
Followers 0