Inverted Posted October 3, 2012 Share Posted October 3, 2012 (edited) I made this for a friend. It sets NumLock On at start of the script and has a 'NumLock toggle' tray option. Tray icon changes indepedently according to the state of NumLock.expandcollapse popup#Region ;**** Directives created by AutoIt3Wrapper_GUI **** #AutoIt3Wrapper_UseUpx=n #AutoIt3Wrapper_Res_Icon_Add="C:STUFFAutoit_stuffNumLockControlon.ico" #AutoIt3Wrapper_Res_Icon_Add="C:STUFFAutoit_stuffNumLockControloff.ico" #EndRegion ;**** Directives created by AutoIt3Wrapper_GUI **** ;Opt("SendAttachMode", 1) Opt("TrayOnEventMode", 1) Opt("TrayMenuMode", 1) TraySetClick(16) Send("{NUMLOCK on}") TrayCreateItem("Toggle NumLock") TrayItemSetOnEvent(-1, "toggleNumLock") TrayCreateItem("Exit") TrayItemSetOnEvent(-1, "ExitScript") While 1 updateTrayIcon() Sleep(100) WEnd Func toggleNumLock() Send("{NUMLOCK toggle}") EndFunc Func updateTrayIcon() $sState = _WinAPI_GetKeyState(0x90) If $sState Then TraySetIcon(@ScriptFullPath, -5) Else TraySetIcon(@ScriptFullPath, -6) EndIf EndFunc Func ExitScript() Exit EndFunc Func _WinAPI_GetKeyState($vkCode) Local $Ret = DllCall('user32.dll', 'int', 'GetKeyState', 'int', $vkCode) Return $Ret[0] EndFuncCompiled script exe for convenience :http://speedy.sh/6sVtN/NumLockControl.zipIt only seems to work fine in win7 x64 but not in my XP virtual machine. I don't know if it's because of Virtualbox keyboard hooking or just XP incompatibility. Pleaselet me know if it works on real XP. Edited October 3, 2012 by Inverted fabyocabral 1 Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now