Jump to content

Recommended Posts

Posted

I'm making a Caps Lock Indicator which displays an image depending on if caps lock is on or off and I keep leaving it one because I'm stupid haha but I want to add a timed alert the reminds me if I leave it on can people help? I'm a bit lost

#Region ;**** Directives created by AutoIt3Wrapper_GUI ****
#AutoIt3Wrapper_icon=output.ico
#EndRegion ;**** Directives created by AutoIt3Wrapper_GUI ****
#NoTrayIcon
#include <TrayConstants.au3>
#include <Misc.au3>
#include <GuiConstantsEx.au3>
#include <WindowsConstants.au3>
#include <MsgBoxConstants.au3>
#include <TrayConstants.au3>

Func _GetCapsLock()
    Local $ret
    $ret = DllCall("user32.dll","long","GetKeyState","long",$VK_CAPITAL)
    Return $ret[0]
 EndFunc

Global Const $VK_CAPITAL = 0x14
      $bcapchk = false
ConsoleWrite($VK_CAPITAL)
while 1
  If _GetCapsLock() Then
    if $bcapchk = False Then
      ConsoleWrite("On")
      ConsoleWrite(@WorkingDir & "\on.ico")
      TraySetIcon("on.ico")
      $bcapchk = True
    EndIf
   Else
      if $bcapchk = True Then
         ConsoleWrite("Off")
         ConsoleWrite(@WorkingDir & "\off.ico")
      TraySetIcon("off.ico")
      $bcapchk = False
      EndIf
      if $bcapchk = True Then
         $begin = TimerInit()
      
   EndIf
WEnd

TrayTip("I'm a title", "I'm the message", 0, $TIP_ICONASTERISK)
MsgBox($MB_SYSTEMMODAL, "", "Press OK to reset the tip.")
TrayTip("clears any tray tip", "", 0)
MsgBox($MB_SYSTEMMODAL, "", "Press OK to see another tip.")
TrayTip("", "A different tray tip.", 5)
Sleep(5000)

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
×
×
  • Create New...