Sign in to follow this  
Followers 0
Dirk98

How to NUMLOCK / CAPSLOCK / SCROLLOCK OFF?

14 posts in this topic

I need my script to shut down the above (no matter if they are on ar off) before the execution of the main rutine.

Pls advise how.

Many thanks. :)

Dirk.

Share this post


Link to post
Share on other sites



What do you mean by "shut down" ? Disable ?


Agreement is not necessary - thinking for one's self is!

My-Colors.jpg

cuniform2.gif

Share this post


Link to post
Share on other sites

Send("{NUMLOCK off}")
Send("{CAPSLOCK off}")
Send("{SCROLLLOCK off}")

:)


[center]"Yes, [our app] runs on Windows as well as Linux, but if you had a Picasso painting, would you put it in the bathroom?" -BitchX.com (IRC client)"I would change the world, but they won't give me the source code." -Unknownsite . blog . portfolio . claimidcode.is.poetry();[/center]

Share this post


Link to post
Share on other sites

Awesome, thank you, guys! Was thinking about the script I'm working on while writing my request.

:)

Share this post


Link to post
Share on other sites

Send("{NUMLOCK off}")
Send("{CAPSLOCK off}")
Send("{SCROLLLOCK off}")
Just to clarify, it does not diasable the keys, it justs sets the state to off. If someone presses one of the keys they will switch state.

To set the state of the capslock, numlock and scrolllock keys

Send("{NumLock on}") ;Turns the NumLock key on

Send("{CapsLock off}") ;Turns the CapsLock key off

Send("{ScrollLock toggle}") ;Toggles the state of ScrollLock


Agreement is not necessary - thinking for one's self is!

My-Colors.jpg

cuniform2.gif

Share this post


Link to post
Share on other sites

Just to clarify, it does not diasable the keys, it justs sets the state to off. If someone presses one of the keys they will switch state.

This might work:

#include 
Send("{NUMLOCK off}")
Send("{CAPSLOCK off}")
Send("{SCROLLLOCK off}")

While 1
    Select 
        Case _IsPressed (90) = 1
            Send ("{NUMLOCK toggle}") 
        Case _IsPressed (91) = 1
            Send ("{SCROLLLOCK toggle}")
        Case _IsPressed (14) = 1
            Send ("{CAPSLOCK toggle}") 
        Case _IsPressed ('1B') = 1
            Exit
    EndSelect
WEnd

Share this post


Link to post
Share on other sites

This might work:

#include 
Send("{NUMLOCK off}")
Send("{CAPSLOCK off}")
Send("{SCROLLLOCK off}")

While 1
    Select 
        Case _IsPressed (90) = 1
            Send ("{NUMLOCK toggle}") 
        Case _IsPressed (91) = 1
            Send ("{SCROLLLOCK toggle}")
        Case _IsPressed (14) = 1
            Send ("{CAPSLOCK toggle}") 
        Case _IsPressed ('1B') = 1
            Exit
    EndSelect
WEnd

Sorry, bear with me, #Include what?

Share this post


Link to post
Share on other sites

#9 ·  Posted (edited)

Sorry, bear with me, #Include what?

It needs Misc.au3

It didn't work for me though...

Oh I see.. the light flashes if I keep the key pressed.. haha.

Edited by Nahuel

Share this post


Link to post
Share on other sites

It needs Misc.au3

It didn't work for me though...

Oh I see.. the light flashes if I keep the key pressed.. haha.

Ok... Thats weird, the #include <misc.au3> completely destroyed itself?? Meh. It theory it should have worked :) Sorry...

Share this post


Link to post
Share on other sites

It does work, but you you have to press the key a little longer...

Share this post


Link to post
Share on other sites

It may be better to use this... it should set it back if it gets changed.

If _GetScrollLock() = 1 Then Send("{SCROLLLOCK Toggle}"); 0 = Off  /  1 = On


....


Func _GetScrollLock(); Checks to see if Scroll Lock is on
    Local $ret
    $ret = DllCall("user32.dll","long","GetKeyState","long",$VK_SCROLL)
    Return $ret[0]
EndFunc

Agreement is not necessary - thinking for one's self is!

My-Colors.jpg

cuniform2.gif

Share this post


Link to post
Share on other sites

It may be better to use this... it should set it back if it gets changed.

If _GetScrollLock() = 1 Then Send("{SCROLLLOCK Toggle}"); 0 = Off  /  1 = On


....


Func _GetScrollLock(); Checks to see if Scroll Lock is on
    Local $ret
    $ret = DllCall("user32.dll","long","GetKeyState","long",$VK_SCROLL)
    Return $ret[0]
EndFunc
Yes. It would :)

Share this post


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
Sign in to follow this  
Followers 0