ATTENTION: You are viewing a page formatted for mobile devices; to view the full web page, click HERE.

DonationCoder.com Software > Coding Snacks

Sticky Keys Ahk request

(1/5) > >>

CleverCat:
Can someone pleeeeeze make me an AHK script to tell me if If my Sticky Keys 'disappear' and are not running!

I spend a few frustrating minutes before I realize they're gone!!

Thanks in Advance?  ;)

aCkRiTe:
Here is an AHK script that checks every second to see if the Sticky Keys are on or off. If they are turned off, a pop-up will appear letting you know they are turned off and give you the option to turn them on. If you choose not to the script will exit cause the pop-up will not go away if they are off. I assume this is what you were looking for. Feel free to tweak in anyway. HTH...


--- ---#SingleInstance Force
#Persistent
#NoEnv
SetBatchLines -1

SetTimer, Timer, 1000

Timer:
RegRead, OutputVar, HKEY_CURRENT_USER, Control Panel\Accessibility\StickyKeys, Flags
If OutputVar <> 511
{
MsgBox, 68, Sticky Keys, The Sticky Keys are turned off. Would you like to turn them on?
IfMsgBox Yes
RegWrite, REG_SZ, HKEY_CURRENT_USER, Control Panel\Accessibility\StickyKeys, Flags, 511
Else
ExitApp
}
Return

CleverCat:
Thanks so much - I loaded the script then turned of Sticky Keys and no message that they were off?

CleverCat:
But if I double click script in folder where I keep it I get the message! Am I doing something wrong?

justice:
the Else Exitapp lines from the script, means the script will stop checking (exit) if you press NO, presumably to stop you getting the same prompt again the next second.

try this instead:

--- ---#SingleInstance Force
#Persistent
#NoEnv

SetTimer, Timer, 2000

Timer:
OldValue := OutputVar
RegRead, OutputVar, HKEY_CURRENT_USER, Control Panel\Accessibility\StickyKeys, Flags
IfNotEqual, OldValue, %OutputVar%
If OutputVar <> 511
{
MsgBox, 68, Sticky Keys, The Sticky Keys are turned off. Would you like to turn them on?
IfMsgBox Yes
RegWrite, REG_SZ, HKEY_CURRENT_USER, Control Panel\Accessibility\StickyKeys, Flags, 511
}
ReturnThis way when stickykeys goes off but you dont want to turn it on the script won't ask again until stickykeys has been turned on manually and goes off again. Also made the script less cpuhungry by only checking every  2 seconds and the script no longer runs at maximum speed.

Navigation

[0] Message Index

[#] Next page

Go to full version