| View previous topic :: View next topic |
| Author |
Message |
Bytales
Joined: 06 Sep 2008 Posts: 84
|
Posted: Tue Sep 16, 2008 11:45 am Post subject: Lock keyboard: Unblock BlockInput ON with the press of a key |
|
|
Is there a way to implement the lock of the keyboard and the mouse while the mouse executes a click or a button press ?
For instance. The script needs to click to coordonates X and Y on the window Z. But i am working on window A wich is on top of window Z
The script would move window Z on corner (to make sure it clicks the correct X and Y coordonates), put it on top, and while it moves to cursor to the designated coordonates (X and Y) everything i input from the mouse or keyboard is discarded, because during that time i could activate another window and the click would not occur on window Z and on coordonates X and Y.
I believe with the mouse it isn't such a big deal, because if the script must click coordonates X and Y it will click it anyway, no matter how hard i move the cursor , (am i right ?) Keeping the window on top, and locking keyboard is what i'm after, because if the window Z is on top, and the keyboard is locked, i am unable to make active another window and the click written in the script or the key presses written in the script will surely work on the window Z, and not some other window i might activate before the clicking or the key presses actualy occur !
Last edited by Bytales on Tue Sep 16, 2008 7:46 pm; edited 1 time in total |
|
| Back to top |
|
 |
Z_Gecko Guest
|
Posted: Tue Sep 16, 2008 11:59 am Post subject: |
|
|
yes!
use BlockInput
e.g.:
| Code: | ^!p::
KeyWait Control ; Wait for the key to be released. Use one KeyWait for each of the hotkey's modifiers.
KeyWait Alt
BlockInput On
; ... send keystrokes and mouse clicks ...
BlockInput Off
return |
|
|
| Back to top |
|
 |
Guest
|
Posted: Tue Sep 16, 2008 12:01 pm Post subject: |
|
|
| it doesnt works in vista btw. |
|
| Back to top |
|
 |
Bytales
Joined: 06 Sep 2008 Posts: 84
|
Posted: Tue Sep 16, 2008 12:53 pm Post subject: |
|
|
| Anonymous wrote: | | it doesnt works in vista btw. |
Not even if i disable UAC ?
What is keywait control and keywait alt ? exactly for ?
| Code: |
BlockInput On
Sleep, 500 ; ||
Send {F1} ; ||
Sleep, 500 ; ||
Send {F2} ; ||
Sleep, 500 ; ||
Send {F3} ; ||
Sleep, 500 ; ||
Send {F4} ; ||
Sleep, 500 ; ||
Send {F5} ; ||
Sleep, 500 ; ||
Send {F6} ;
Sleep, 500 ;
Blockinput Off
|
Will this press the f1...f6 keys ? |
|
| Back to top |
|
 |
Bytales
Joined: 06 Sep 2008 Posts: 84
|
Posted: Tue Sep 16, 2008 1:24 pm Post subject: |
|
|
It works, even in vista ! All input blocked succesfully. I've read the help file regarding block input. How do i avoid a key becoming stuck down ?
Do i need to specify a certain key ?
It is kinda hard if i'm typing text while blockinput occurs !
Also i would like to ask something else.
I want like to know if something like this is also possible:
Consider windows W . I know the ahk_class of this window. Window W is inactive, meaning in the foregroung. I work currently on window Z which is different every time.
I can make it so that i activate windows W, block input, press buttons on windows W, release input and switch back to windows Z, ?
For that i will need to get ahk_class of the active window(the Z window), store it in a variable, switch to window W, block input, press buttons release input and switch to a window with ahk class like the one stored in the variable.
How do i make a script to get the ahk class of the current active window ? |
|
| Back to top |
|
 |
Bytales
Joined: 06 Sep 2008 Posts: 84
|
Posted: Tue Sep 16, 2008 7:29 pm Post subject: |
|
|
| Code: |
BlockInput ON
; script here that is executing
;
;
;
BlockInput OFF
|
Is there a way to Unblock The blockInput ON before it reaches BlockInput OFF with the press of a certain key Combination ? |
|
| Back to top |
|
 |
Bytales
Joined: 06 Sep 2008 Posts: 84
|
Posted: Tue Sep 16, 2008 8:16 pm Post subject: |
|
|
| Code: |
^B::BlockInput ON ; blocking input
^R::BlockInput OFF ;releasing input !
|
I wonder, will control-R work, or it too will be blocked. If a script is blocking all input, is there any way to release the input without using reset ? |
|
| Back to top |
|
 |
Sivvy
Joined: 21 Jul 2008 Posts: 726 Location: Calgary, AB, Canada
|
Posted: Tue Sep 16, 2008 8:37 pm Post subject: |
|
|
No matter what, Nothing in AHK can block Ctrl+Alt+Del.
| AHK HelpFile wrote: | | Input blocking is automatically and momentarily disabled whenever an ALT event is sent (then re-enabled afterward). |
|
|
| Back to top |
|
 |
Bytales
Joined: 06 Sep 2008 Posts: 84
|
Posted: Tue Sep 16, 2008 9:07 pm Post subject: |
|
|
| Sivvy wrote: | No matter what, Nothing in AHK can block Ctrl+Alt+Del.
| AHK HelpFile wrote: | | Input blocking is automatically and momentarily disabled whenever an ALT event is sent (then re-enabled afterward). |
|
What exactly is an alt event ? |
|
| Back to top |
|
 |
Sivvy
Joined: 21 Jul 2008 Posts: 726 Location: Calgary, AB, Canada
|
Posted: Tue Sep 16, 2008 10:48 pm Post subject: |
|
|
| Press Alt. |
|
| Back to top |
|
 |
|