Sign in to follow this  
Followers 0
zellis

how do i disable the keyboard?

14 posts in this topic

im looking to run a script that disables the keyboard but keeps functionality of the mouse, any ideas on what function to use?

thanks

Share this post


Link to post
Share on other sites



#2 ·  Posted (edited)

BlockInput() Disables both ... not sure about just the keyboard.

Edited by Fossil Rock

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

You could try using hotkeyset() to bind all the keys to nothing, that would disable at least most of the keyboard...

Share this post


Link to post
Share on other sites

#4 ·  Posted (edited)

im looking to run a script that disables the keyboard but keeps functionality of the mouse, any ideas on what function to use?

thanks

What are you trying to do? Disabling the keyboard is just a bad idea. I have never used a program that has disabled my keyboard and i don't plan on ever using one that does.

Completely disabling the keyboard should be avoided at all costs.

Edited by The Kandie Man

"So man has sown the wind and reaped the world. Perhaps in the next few hours there will no remembrance of the past and no hope for the future that might have been." & _"All the works of man will be consumed in the great fire after which he was created." & _"And if there is a future for man, insensitive as he is, proud and defiant in his pursuit of power, let him resolve to live it lovingly, for he knows well how to do so." & _"Then he may say once more, 'Truly the light is sweet, and what a pleasant thing it is for the eyes to see the sun.'" - The Day the Earth Caught Fire

Share this post


Link to post
Share on other sites

What are you trying to do? Disabling the keyboard is just a bad idea. I have never used a program that has disabled my keyboard and i don't plan on ever using one that does.

Of course... when you do... you can always be thankful that you finally know where your power button is ;)

[center]Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer.[/center]

Share this post


Link to post
Share on other sites

#6 ·  Posted (edited)

What are you trying to do? Disabling the keyboard is just a bad idea. I have never used a program that has disabled my keyboard and i don't plan on ever using one that does.

Disabling the keyboard can be useful in an environment where you don't want accidental input. I used to remove the keyboard to accomplish this. I then had a script running that could be controller by the mouse alone. If I needed a keyboard I could either hook one back up or remote into it.

Good or bad idea is irrelevant, weather you've used one or have ever needed to or not is also irrelevant. As far as you ever using one... who cares...

Completely disabling the keyboard should be avoided at all costs.

Giving bad advise should be avoided at all costs. Edited by Fossil Rock

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

#7 ·  Posted (edited)

Of course... when you do... you can always be thankful that you finally know where your power button is ;)

Of that i most certainly can Ron. And upon the visitation of such a program, i will promptly submit it to Norton as a virus and i will then promptly delete it and then blacklist the site i downloaded it from.

:lmao:

Disabling the keyboard can be useful in an environment where you don't want accidental input. I used to remove the keyboard to accomplish this. I then had a script running that could be controller by the mouse alone. If I needed a keyboard I could either hook one back up or remote into it.

Good or bad idea is irrelevant, weather you've used one or have ever needed to or not is also irrelevant. As far as you ever using one... who cares...

Giving bad advise should be avoided at all costs.

I have needed a blockinput before and i have found ways that prevent accidental input without having to block the keyboard. The most effective way is to simply use Control send while minimizing the application and hiding its window. This ultimately prevents any unwanted user input. If zellis doesn't know about this, i apologize, but there is usually more than one way to do something, and doing in the best way should always be the way to go.

Edited by The Kandie Man

"So man has sown the wind and reaped the world. Perhaps in the next few hours there will no remembrance of the past and no hope for the future that might have been." & _"All the works of man will be consumed in the great fire after which he was created." & _"And if there is a future for man, insensitive as he is, proud and defiant in his pursuit of power, let him resolve to live it lovingly, for he knows well how to do so." & _"Then he may say once more, 'Truly the light is sweet, and what a pleasant thing it is for the eyes to see the sun.'" - The Day the Earth Caught Fire

Share this post


Link to post
Share on other sites

Of course... when you do... you can always be thankful that you finally know where your power button is ;)

LOL, not my dad, one time my dad tried to kick me off the computer (Something about me being on too long... :lmao: ) and he stormed over and was like "I'm turning the damn thing off!" then he was like "... How do you turn it off?" I point to the ESC key and hey starts mashing the button. Then he gets mad at me, and I can't help but laugh at him. So he starts laughing too.

It was funny.

Share this post


Link to post
Share on other sites

The "remote" thing still doesn't explain why anyone would "have" to block the keys or mouse in my opinion.

Something put together with care, should easy enough be able to accomplish any task without fear of user interactions IMHO.


[center]Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer.[/center]

Share this post


Link to post
Share on other sites

Here is a little example of how to block user input interference with the automation of a control without blocking the whole keyboard:

Messagebox.au3

Msgbox(0,"Clickmeplease","click my button")
Msgbox(0,"Success","The script clicked me and the user didn't have anything to do with it.")

To try it out, run the messagbox.au3. Once you do, you will see a messagebox. This messagbox could represent anything, an installer, or a program that you want to automate.

Now, run clickit.au3. Upon running it, you will notice that the messagbox from the messagebox.au3 script disappears. This is because the clickit script has just hidden it. The clickit script will then notify you that the messagebox is now hidden with a messagebox of its own. At that point it will go about automating and click the OK button on the hidden messagebox. A user would have no chance of interfering with the automation of the hidden messagebox, because it is hidden.

This is one of the better ways to prevent accidental user input interference with the automation of another application.

I hope this helps zellis, if this is what you are trying to do.

-The Kandie Man


"So man has sown the wind and reaped the world. Perhaps in the next few hours there will no remembrance of the past and no hope for the future that might have been." & _"All the works of man will be consumed in the great fire after which he was created." & _"And if there is a future for man, insensitive as he is, proud and defiant in his pursuit of power, let him resolve to live it lovingly, for he knows well how to do so." & _"Then he may say once more, 'Truly the light is sweet, and what a pleasant thing it is for the eyes to see the sun.'" - The Day the Earth Caught Fire

Share this post


Link to post
Share on other sites

the reason i want to disable the keyboard but not the mouse is that i have a 1ys old hthat comes up to the keyboard when we are on it, for us or for showing him videos and he wants to do what we are doing, and starts hitting all the keys.... i do not want data loss due to him learning, so i kill the keyboard and retain the mouse.

Share this post


Link to post
Share on other sites

#12 ·  Posted (edited)

the reason i want to disable the keyboard but not the mouse is that i have a 1ys old hthat comes up to the keyboard when we are on it, for us or for showing him videos and he wants to do what we are doing, and starts hitting all the keys.... i do not want data loss due to him learning, so i kill the keyboard and retain the mouse.

Excellent Reason. In this case, the best way to do this would be to do:

BlockInput(1)

while 1
sleep(1000)
wend

Using that in a script will disable the input, completely. This means the mouse too ;).

To regain control a computer once this has been activated, simply press ctrl+alt+del and then close the program by right clicking it in the tray and clicking exit.

This should allow you to leave your computer on without your 1 year old messing with things

However, you said you like to show him what you are doing, as a result, i will try to write up a script that just blocks keyboard input.

Edited by The Kandie Man

"So man has sown the wind and reaped the world. Perhaps in the next few hours there will no remembrance of the past and no hope for the future that might have been." & _"All the works of man will be consumed in the great fire after which he was created." & _"And if there is a future for man, insensitive as he is, proud and defiant in his pursuit of power, let him resolve to live it lovingly, for he knows well how to do so." & _"Then he may say once more, 'Truly the light is sweet, and what a pleasant thing it is for the eyes to see the sun.'" - The Day the Earth Caught Fire

Share this post


Link to post
Share on other sites

thankyou.

now if i still want to retain my mouse, i can just use the hotkeyset() for all keys, i just cannot set whats below

The following hotkeys cannot be set:

Ctrl+Alt+Delete It is reserved by Windows

F12 It is also reserved by Windows, according to its API.

NumPad's Enter Key Instead, use {Enter} which captures both Enter keys on the keyboard.

Win+B,D,E,F,L,M,R,U; and Win+Shift+M These are built-in Windows shortcuts. Note: Win+B and Win+L might only be reserved on Windows XP and above.

Alt, Ctrl, Shift, Win These are the modifier keys themselves!

Other Any global hotkeys a user has defined using third-party software, any combos of two or more "base keys" such as '{F1}{F2}', and any keys of the form '{LALT}' or '{ALTDOWN}'.

i dont think he can do the combos to delete anything or to accidently move any files, thats what im woried about.

Share this post


Link to post
Share on other sites

#14 ·  Posted (edited)

thankyou.

now if i still want to retain my mouse, i can just use the hotkeyset() for all keys, i just cannot set whats below

The following hotkeys cannot be set:

Ctrl+Alt+Delete It is reserved by Windows

F12 It is also reserved by Windows, according to its API.

NumPad's Enter Key Instead, use {Enter} which captures both Enter keys on the keyboard.

Win+B,D,E,F,L,M,R,U; and Win+Shift+M These are built-in Windows shortcuts. Note: Win+B and Win+L might only be reserved on Windows XP and above.

Alt, Ctrl, Shift, Win These are the modifier keys themselves!

Other Any global hotkeys a user has defined using third-party software, any combos of two or more "base keys" such as '{F1}{F2}', and any keys of the form '{LALT}' or '{ALTDOWN}'.

i dont think he can do the combos to delete anything or to accidently move any files, thats what im woried about.

Yeah, don't worry about it. I wrote you a script, actually two scripts, since an autoit script can only trap 64 keys at a time, i needed to write two scripts so that it could capture all the keys on the keyboard.

Here they are:

This is the first script:

BlockKeyboardInput1.au3

For $i_counter = 1 to 64
    Hotkeyset(Chr ( $i_counter + 31 ),"Keypress")
Next

while 1
    sleep(1000)
WEnd
Func Keypress()
;anytime a key is pressed, whatever is in here will be executed.  In this case, nothing
EndFunc


oÝ÷ Ù8b²+-ërݱÊâ¦ÖÁ$)졪Ý"zn·f®ßöÚºÚ"µÍÜ  ÌÍÚWØÛÝ[HHÈÌRÝÙ^Ù]
Ú
    ÌÍÚWØÛÝ[
ÈMH
K   ][ÝÒÙ^ÜÉ][ÝÊB^ÝÙ^]
    ][ÝÞÑ[I][ÝË    ][ÝÒÙ^ÜÉ][ÝÊBÝÙ^]
    ][ÝÞÑØßI][ÝË ][ÝÒÙ^ÜÉ][ÝÊBÝÙ^]
    ][ÝÞÑ[]_I][ÝË  ][ÝÒÙ^ÜÉ][ÝÊBÝÙ^]
    ][ÝÞÒÛY_I][ÝË ][ÝÒÙ^ÜÉ][ÝÊBÝÙ^]
    ][ÝÞÑ[I][ÝË    ][ÝÒÙ^ÜÉ][ÝÊBÝÙ^]
    ][ÝÞÔÕTI][ÝË  ][ÝÒÙ^ÜÉ][ÝÊBÝÙ^]
    ][ÝÞÔÑI][ÝË   ][ÝÒÙ^ÜÉ][ÝÊBÝÙ^]
    ][ÝÞÕTI][ÝË    ][ÝÒÙ^ÜÉ][ÝÊBÝÙ^]
    ][ÝÞÑÝÛI][ÝË ][ÝÒÙ^ÜÉ][ÝÊBÝÙ^]
    ][ÝÞÓYI][ÝË    ][ÝÒÙ^ÜÉ][ÝÊBÝÙ^]
    ][ÝÞÔYÚI][ÝË  ][ÝÒÙ^ÜÉ][ÝÊBÝÙ^]
    ][ÝÞÔ]Ù_I][ÝË ][ÝÒÙ^ÜÉ][ÝÊBÝÙ^]
    ][ÝÞÔ[ØÜY[I][ÝË  ][ÝÒÙ^ÜÉ][ÝÊBÝÙ^]
    ][ÝÞÔØÜÛØÚßI][ÝË ][ÝÒÙ^ÜÉ][ÝÊBÝÙ^]
    ][ÝÞÓ[[ØÚßI][ÝË ][ÝÒÙ^ÜÉ][ÝÊBÝÙ^]
    ][ÝÞÐØÛØÚßI][ÝË   ][ÝÒÙ^ÜÉ][ÝÊBÝÙ^]
    ][ÝÞÕXI][ÝË    ][ÝÒÙ^ÜÉ][ÝÊBÝÙ^]
    ][ÝÞÑ_I][ÝË    ][ÝÒÙ^ÜÉ][ÝÊBÝÙ^]
    ][ÝÞÑI][ÝË ][ÝÒÙ^ÜÉ][ÝÊBÝÙ^]
    ][ÝÞÑßI][ÝË   ][ÝÒÙ^ÜÉ][ÝÊBÝÙ^]
    ][ÝÞÑI][ÝË ][ÝÒÙ^ÜÉ][ÝÊBÝÙ^]
    ][ÝÞÑ_I][ÝË    ][ÝÒÙ^ÜÉ][ÝÊBÝÙ^]
    ][ÝÞÑI][ÝË ][ÝÒÙ^ÜÉ][ÝÊBÝÙ^]
    ][ÝÞÑßI][ÝË   ][ÝÒÙ^ÜÉ][ÝÊBÝÙ^]
    ][ÝÞÑI][ÝË ][ÝÒÙ^ÜÉ][ÝÊBÝÙ^]
    ][ÝÞÑ_I][ÝË    ][ÝÒÙ^ÜÉ][ÝÊBÝÙ^]
    ][ÝÞÑLI][ÝË    ][ÝÒÙ^ÜÉ][ÝÊBÝÙ^]
    ][ÝÞÑL_I][ÝË   ][ÝÒÙ^ÜÉ][ÝÊBØØ[ÌÎNÝÈL]ÛÛÌÎNÝ]YBÚ[HBÛY
L
BÑ[[ÈÙ^ÜÊ
BØ[][YHHÙ^HÈÜÙYÚ]]È[[H^]Y[ÈØÙKÝ[Â[[Â

To block the keyboard input, simple run both these scripts at the same time. The easiest way to do this would be to simple compile both into .exe files and then use the following batch file to execute them both

Blockkeyboardinput.bat

@start BlockKeyboardInput1.exe
@start BlockKeyboardInput2.exe

To end the keyboard block input, simply right click the Autoit icons in the system tray and then click exit. Once they are closed you will once again have control of your keyboard.

I hope that helps.

-The Kandie Man

Edited by The Kandie Man

"So man has sown the wind and reaped the world. Perhaps in the next few hours there will no remembrance of the past and no hope for the future that might have been." & _"All the works of man will be consumed in the great fire after which he was created." & _"And if there is a future for man, insensitive as he is, proud and defiant in his pursuit of power, let him resolve to live it lovingly, for he knows well how to do so." & _"Then he may say once more, 'Truly the light is sweet, and what a pleasant thing it is for the eyes to see the sun.'" - The Day the Earth Caught Fire

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