Jump to content

how do i disable the keyboard?


zellis
 Share

Recommended Posts

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

Link to comment
Share on other sites

  • Moderators

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 ;)

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.

Link to comment
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.

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

Link to comment
Share on other sites

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

Link to comment
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.

Link to comment
Share on other sites

  • Moderators

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.

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.

Link to comment
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

Link to comment
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.

Link to comment
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.

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

Link to comment
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.

Link to comment
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.

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

Link to comment
Share on other sites

  • 15 years later...

#include <MsgBoxConstants.au3>

$sText local = ""
Para $i = 1 a 90
$sText = $sText & Chr($i) ; O $sText &= Chr($i) también se puede usar.
Siguiente
MsgBox($MB_SYSTEMMODAL, "Alfabeto en mayúsculas Bloqueadas; presione F1 para desbloquear", $sText) ; Muestra los caracteres entre 65 y 90.

Pulsación de teclaOFF()

while 1
sleep(1000)
HotKeySet("{ESC}", "On_Exit")
; HotKeySet("{F1}", "KeypressON")
HotKeySet("!q", "KeypressON")
WEnd


Func Keypress()
;cada vez que se presiona una tecla, lo que esté aquí se ejecutará. En este caso, nada
endfunc


Func KeypressOFF()
   For $i_counter = 1 to 90
       Hotkeyset(Chr ( $i_counter + 31 ),"Keypress")
   Next
EndFunc


Func KeypressON()
   HotKeySet
EndFunc

Func On_Exit()
    Exit
 EndFunc

Link to comment
Share on other sites

  • Developers

@Yir77, this is your second post. The first one was in an 9 years old thread and this one is 17 years old. So please don't resurrect old threads witja solution as the OP for sure is waiting for the answer and more and it's an annoyance for the current members.

Jos

SciTE4AutoIt3 Full installer Download page   - Beta files       Read before posting     How to post scriptsource   Forum etiquette  Forum Rules 
 
Live for the present,
Dream of the future,
Learn from the past.
  :)

Link to comment
Share on other sites

  • Jos locked this topic
Guest
This topic is now closed to further replies.
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...