Jump to content

{CAPSLOCK OFF} and {CAPSLOCK TOGGLE} not toggling caps lock off


Recommended Posts

Hi all,

I'm encountering a weird issue. I'm attempting to toggle off Caps Lock and it briefly turns it off before it just turns right back on causing the LED to just strobe constantly. I'm using the following code:

Opt("WinTitleMatchMode", 2)

Global Const $VK_CAPITAL = 0x14

Main()

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

Func Main()
    While 1
        If _GetCapsLock() And WinActive("Chrome") Then Send("{CAPSLOCK OFF}")
    WEnd
EndFunc

I've tried the following to no resolve:

  • Using #RequireAdmin
  • Using {CAPSLOCK TOGGLE}
  • Setting "SendKeyDownDelay" to values other than 5
  • Adding Sleep after attempting to turn off CapsLock
  • Using _WinAPI_GetAsyncKeyState($VK_CAPITAL)

My working environment is:

  • AutoIt 3.3.14.4, running as Standard user (Admin also attempted as noted)
  • Running as a non-compiled script in SciTE
  • Windows 7 Enterprise 7601 SP1
  • McAfee Enterprise

I'm sure I'm forgetting something basic, so any help is appreciated.

Edited by rcmaehl
Add working environment

My UDFs are generally for me. If they aren't updated for a while, it means I'm not using them myself. As soon as I start using them again, they'll get updated.

My Projects

WhyNotWin11
Cisco FinesseGithubIRC UDFWindowEx UDF

 

Link to post
Share on other sites
1 minute ago, rm4453 said:

Yes, that is the code I'm using, Line 15 in the OP code block.

EDIT: I'm an idiot thanks

Edited by rcmaehl

My UDFs are generally for me. If they aren't updated for a while, it means I'm not using them myself. As soon as I start using them again, they'll get updated.

My Projects

WhyNotWin11
Cisco FinesseGithubIRC UDFWindowEx UDF

 

Link to post
Share on other sites
Just now, rm4453 said:

you are missing this portion :

Opt("SendCapslockMode", 0)

 

Yep, just updated my reply. Thanks!

My UDFs are generally for me. If they aren't updated for a while, it means I'm not using them myself. As soon as I start using them again, they'll get updated.

My Projects

WhyNotWin11
Cisco FinesseGithubIRC UDFWindowEx UDF

 

Link to post
Share on other sites
1 minute ago, rcmaehl said:

Yes, that is the code I'm using, Line 15 in the OP code block.

No, you're not. You need to use Opt("SetCapsLockMode, 0)

If I posted any code, assume that code was written using the latest release version unless stated otherwise. Also, if it doesn't work on XP I can't help with that because I don't have access to XP, and I'm not going to.
Give a programmer the correct code and he can do his work for a day. Teach a programmer to debug and he can do his work for a lifetime - by Chirag Gude
How to ask questions the smart way!

I hereby grant any person the right to use any code I post, that I am the original author of, on the autoitscript.com forums, unless I've specifically stated otherwise in the code or the thread post. If you do use my code all I ask, as a courtesy, is to make note of where you got it from.

Back up and restore Windows user files _Array.au3 - Modified array functions that include support for 2D arrays.  -  ColorChooser - An add-on for SciTE that pops up a color dialog so you can select and paste a color code into a script.  -  Customizable Splashscreen GUI w/Progress Bar - Create a custom "splash screen" GUI with a progress bar and custom label.  -  _FileGetProperty - Retrieve the properties of a file  -  SciTE Toolbar - A toolbar demo for use with the SciTE editor  -  GUIRegisterMsg demo - Demo script to show how to use the Windows messages to interact with controls and your GUI.  -   Latin Square password generator

Link to post
Share on other sites
Just now, rcmaehl said:

Yep, just updated my reply. Thanks!

NP glad to help, next time please try a slightly broader search. *I searched "autoit capslock off" and it pulled that within first few results*

Good Luck!

Link to post
Share on other sites
3 minutes ago, rm4453 said:

NP glad to help, next time please try a slightly broader search. *I searched "autoit capslock off" and it pulled that within first few results*

 Good Luck!

Yeah I was Googling or autoit caps lock strobe and it wasn't pulling any useful results, and forum search wasn't helpful in the slightest with those keywords. Looks like I should have changed caps lock to capslock and it would have pulled better results using the forum search engine.

Edited by rcmaehl

My UDFs are generally for me. If they aren't updated for a while, it means I'm not using them myself. As soon as I start using them again, they'll get updated.

My Projects

WhyNotWin11
Cisco FinesseGithubIRC UDFWindowEx UDF

 

Link to post
Share on other sites
Just now, rcmaehl said:

Yeah I was Googling or autoit caps lock strobe and it wasn't pulling any useful results, and forum search wasn't helpful in the slightest with those keywords. Looks like I should have changed caps lock to capslock and it would have pulled better results using the forum search engine.

Yeah always remember if your search isn't pulling results take a word off, it usually helps a TON.

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
  • Recently Browsing   0 members

    No registered users viewing this page.

  • Similar Content

    • By hendrikhe
      Hello,
      I am trying to create a small tool which alerts me when I receive a message from Skype for Business.
      You know sometimes you simple miss a conversation...
      I need to know when the message windows pops up:
       
      If message window active Then
      play a very loud sound
      EndIF
       
      Usually I would use WinActive() function, however it requires a title. And this doenst work, because the title is the name of the person 
      messaging me, and can change every time.
      Is it possible to check if a Class "LyncTabFrameHostWindowClass" is active?
       

       
       
       
    • By hotkidd
      Have this AutoIT script used to click a button in Web to export data to Excel. It works well when run it from command line or AutoIT compiled .exe.
      But after added it to a Win10 VM Task Scheduler as I need to run it daily, it fails to be executed.
      Steps to reproduce:
      1. Compile the script to .exe.
      2. Go to Task Scheduler. Create the task to run this .exe.
      3. Right click on the created task -> run  -> shows nothing.
       
      Snippet of the code:
      Local $URL = "URL" Local $title = "title" Local $name = "name" Local $oIE = _IECreate() _IEPropertySet($oIE, "toolbar", False ) _IEPropertySet($oIE, "height", 800 ) _IEPropertySet($oIE, "width", 1000 ) _IEPropertySet($oIE, "left", 0 ) _IEPropertySet($oIE, "top", 0 ) _IEPropertySet($oIE, "resizable", False ) _IENavigate($oIE, $URL) Sleep(5000) _IENavigate($oIE, $ReportWeb) Sleep(10000) ;click the button to export the Excel and save it ControlClick($titleName, $textName, "[CLASS:Internet Explorer_Server; INSTANCE:1]","main",1,100,100) ControlSend($title,$name,"[CLASS:DirectUIHWND; INSTANCE:1]","{ENTER}")
    • By trescon
      Good evening, I need to configure a graphical interface where the contents of some "Button" are taken from a file I have foreseen to include with "#include".
      For the text no problem, the problem comes when I'm going to assign the color to the background of the "Button", the "Button" becomes BLACK WHITE.
      I included in the included file as follows:
      $ Promotion_Color = "$ Color_Red"
      Clarity I also imported #include the library <ColorConstants.au3>
      In the main program I wrote like this:
      $ Promotion = GUICtrlCreateButton ($ Promotion, Dim_Fin_X + $ 170, $ Dim_Fin_Y, 750.120)
      GUICtrlSetFont (-1, 70, 800, 0, "Calibri")
      GUICtrlSetBkColor ($ Promotion, $ Promotion_Color); will change background color
      I thank all those who want to help me
      Alberto
×
×
  • Create New...