I want to show an image on the screen every time the caps lock is on, this is mostly working but every now and then when fast clicking or the script is opening something,
clicking on the capslock does not remove the message / not showing it and thus causing the message to be out of sync (caps lock is off but there is still the message / caps lock is on but there is no message).
This is the code I am using:
Code: Select all
~*CapsLock::
state := GetKeyState("CapsLock", "T")
if state = 1
{
SplashImageGUI("command-mode.png", "center", "center", false, true)
}
else
{
DestroySplashGUI()
}
return
SplashImageGUI(Picture, X, Y, Duration, Transparent = false)
{
Gui, XPT99:Margin , 0, 0
Gui, XPT99:Add, Picture,, %Picture%
Gui, XPT99:Color, ECE9D8
Gui, XPT99:+LastFound -Caption +AlwaysOnTop +ToolWindow -Border
If Transparent
{
Winset, TransColor, ECE9D8
}
Gui, XPT99:Show, x%X% y%Y% NoActivate
if (Duration !== false)
{
SetTimer, DestroySplashGUI, -%Duration%
}
return
}
DestroySplashGUI()
{
Gui, XPT99:Destroy
return
}