Garanator Posted October 16, 2005 Share Posted October 16, 2005 I have a couple of keys I want to disable while my script runs to make sure that the scripts runs right. I need to disable esc, alt + anything, windows key, b, c, t, and w. Could someone just show me an example of how to disable one i can figure out the rest ty. I learn better from examples then from saying use command hotkeyset or whatever. Garanator Link to comment Share on other sites More sharing options...
Sokko Posted October 16, 2005 Share Posted October 16, 2005 (edited) You can't disable the Windows key or any built-in shortcuts involving it, and while you can disable combinations of ALT+Something, you can't block the ALT key by itself (look in the help files on HotKeySet for details). Here's an example of how to disable ALT+B: HotKeySet("!b","_Dummy") ;The rest of your script goes here Func _Dummy() ;This is a useless function EndFunc If your script is dependent on the user not doing anything while it's running, it might be a better idea to use BlockInput, which kills the mouse and everything on the keyboard except Ctrl-Alt-Del. Edited October 16, 2005 by Sokko sulfur 1 Link to comment Share on other sites More sharing options...
Garanator Posted October 16, 2005 Author Share Posted October 16, 2005 (edited) Wow I really like that blockinput. Thanks for the help Edit: nvm that blockinput isn't that great it just locks everything up and barely runs the script is there any other way I can get rid of user commands? I want to get rid of the keys for the user but want them to work for the script so does this hotkeyset work? Edited October 17, 2005 by Garanator Link to comment Share on other sites More sharing options...
Garanator Posted October 17, 2005 Author Share Posted October 17, 2005 In the !b whats the ! for? Sorry this is my third day using autoit? Link to comment Share on other sites More sharing options...
LxP Posted October 17, 2005 Share Posted October 17, 2005 The ! in !b means 'the next key should be sent as Alt+key'. Check out Send() for further info on other modifiers.According to the help file, BlockInput() has issues under Windows 98 and ME in that it can't send simulated input (Send() etc.) while BlockInput() is active. Link to comment Share on other sites More sharing options...
Garanator Posted October 17, 2005 Author Share Posted October 17, 2005 Well I tested my script with blockinput on a WinXP and it still doesn;t work that well. Do you know anything else i can try. That hotkeyset function still allows me to hit b which screws up my script. Any other things I can try? Link to comment Share on other sites More sharing options...
LxP Posted October 17, 2005 Share Posted October 17, 2005 No it doesn't: ; Disable the B key HotkeySet("b", "Nothing") ; Disable Shift+B HotkeySet("+b", "Nothing") ; Provide a method of testing InputBox("Test", "Enter the word 'Bob':") ; A function that does nothing Func Nothing() EndFunc Link to comment Share on other sites More sharing options...
seandisanti Posted October 17, 2005 Share Posted October 17, 2005 You can't disable the Windows key or any built-in shortcuts involving it, and while you can disable combinations of ALT+Something, you can't block the ALT key by itself (look in the help files on HotKeySet for details). Here's an example of how to disable ALT+B:HotKeySet("!b","_Dummy") ;The rest of your script goes here Func _Dummy() ;This is a useless function EndFuncIf your script is dependent on the user not doing anything while it's running, it might be a better idea to use BlockInput, which kills the mouse and everything on the keyboard except Ctrl-Alt-Del.if you're tricky enough you can block any key/keys except the function key on a laptop, even the ctrl alt delete can be kind of blocked (depending on the sleep in the loop and the rate the keys are pressed). i've posted a few solutions to similar problems, so i don't want to write the code again, basically, you can use _IsPressed() to see what keys are being pressed and respond accordingly. if an alt key is pressed, send an {ALTUP} and an {ESCAPE}, same for windows key, and for the regular alpha keys, just hotkey out any that you don't want used as in the examples provided. also i'd suggest checking this forum for solutions, because as i said, there have been many examples given for this same problem, except possibly different keys... sulfur 1 Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now