AutoHotkey Homepage AutoHotkey Community
Let's help each other out
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

BlockInput

 
Post new topic   Reply to topic    AutoHotkey Community Forum Index -> Wish List
View previous topic :: View next topic  
Author Message
beardboy



Joined: 02 Mar 2004
Posts: 444
Location: SLC, Utah

PostPosted: Sat Apr 03, 2004 11:20 pm    Post subject: BlockInput Reply with quote

Any chance that another option could be added to BlockInput to only block user input when the script is sending input. It could either be an addition to BlockInput or make a seperate Directive command that could be used. I end up blocking input in a lot of my scripts only when the script needs to block it, so that if the script gets stuck in a loop somewhere the user doesn't have to hit ctrl+alt+del to get control back. But adding multiple a "BlockInput, On" and "BlockInput, Off" over and over again adds a lot of lines to the code.

BlockInput, Script

Could block all user input when keyboard or mouse command from the script are ran. And using "BlockInput, On" or "BlockInput, Off" would reset it back to normal and would just follow the normal BlockInput commands.

Or using a directive command like #BlockInput

Let me know what you think.

thanks,
beardboy
Back to top
View user's profile Send private message Send e-mail Visit poster's website AIM Address Yahoo Messenger MSN Messenger
Chris
Site Admin


Joined: 02 Mar 2004
Posts: 10467

PostPosted: Sun Apr 04, 2004 1:04 am    Post subject: Reply with quote

It's a good idea. I'll see about how easy this is to implement.
Back to top
View user's profile Send private message Send e-mail
Chris
Site Admin


Joined: 02 Mar 2004
Posts: 10467

PostPosted: Thu Aug 19, 2004 12:58 am    Post subject: Reply with quote

To-do list item: "Improve the reliability of the Send command and perhaps MouseClick/Move/ControlSend(?) by having an optional mode that uses BlockInput during each operation."

I was thinking about how to approach this feature. Beardboy's idea of having a new option for the command is probably best, e.g. "BlockInput Send|Mouse|SendAndMouse|Default". This would have BlockInput turned on/off before/after every Send and/or MouseMove/Click/Drag.

The selective modes would only work on NT/2k/XP+, because on Win98, BlockInput prevents the simulation of mouse and keyboard events so it would be pointless in that case.

Another issue is that it seems the Alt keystroke cannot be simulated (sent) on any OS while BlockInput is enabled (does anyone's experience reveal any other limitations besides this?). So maybe any Send that uses the Alt key should be automatically exempt from the selective mode.

Comments are welcome.
Back to top
View user's profile Send private message Send e-mail
beardboy



Joined: 02 Mar 2004
Posts: 444
Location: SLC, Utah

PostPosted: Thu Aug 19, 2004 1:10 am    Post subject: Reply with quote

Quote:
Another issue is that it seems the Alt keystroke cannot be simulated (sent) on any OS while BlockInput is enabled (does anyone's experience reveal any other limitations besides this?).

I can't seem to duplicate this. I have multiple scripts that BlockInput on things like "Send, !n" and they all seem to work. I did a couple of test scripts with a program I have and doing both "!n" and "{alt}n" work with BlockInput on.

Well now I just did a test with Metapad, and "{alt}f" works but "!f" doesn't. Interesting. Well I have never had a problem with any of my scripts using Alt using BlockInput, but maybe I haven't used the alt key that much.

thanks,
beardboy
Back to top
View user's profile Send private message Send e-mail Visit poster's website AIM Address Yahoo Messenger MSN Messenger
Chris
Site Admin


Joined: 02 Mar 2004
Posts: 10467

PostPosted: Thu Aug 19, 2004 6:19 pm    Post subject: Reply with quote

Things always seem to take much longer than I had hoped they would, so the above feature didn't make it into this version. However, it should be the next thing I work on.
Back to top
View user's profile Send private message Send e-mail
Chris
Site Admin


Joined: 02 Mar 2004
Posts: 10467

PostPosted: Thu Aug 26, 2004 4:07 am    Post subject: Reply with quote

After many months on the list, this item has been completed. It's in the installer at http://www.autohotkey.com/download/ -- thanks for the idea

Improved BlockInput to optionally come on automatically during any of the following commands: Send, SendRaw, MouseMove, MouseClick, and MouseClickDrag. [thanks beardboy]

Changed BlockInput so that input blocking is momentarily disabled whenever the Send command needs to simulate an ALT keystroke. Since there is a slight chance this will break existing scripts that attempt to send ALT while BlockInput is ON, please check and adjust accordingly.
Back to top
View user's profile Send private message Send e-mail
jordis



Joined: 30 Jul 2004
Posts: 78

PostPosted: Thu Aug 26, 2004 10:30 pm    Post subject: Reply with quote

In the same line, as an improvement suggestion for BlockInput:

During my script execution, I'd like to block user's input - mouse and keyb (like in BlockInput) but still let the user exit the script when pressing ESC or another predefined key or hotkey...
I think blocking all user's input is useful to avoid unexperienced users from getting in the way of an script during execution (e.g. prevent losing focus of applications the script is interacting with) but then again, allowing them to stop the script at their request (with ESC for example) would be handy when something wrong happens with the script or when the user wishes to terminate it before completion (for scripts that perform their "things" for a long time)
As I understand, the only way to stop a script which has blocked input is pressing CTRL+ALT+DEL and getting to the Task Manager to terminate the associated process. For unexperienced users, this could be difficult to handle and even dangerous.
Any thoughts on this?
Back to top
View user's profile Send private message
Chris
Site Admin


Joined: 02 Mar 2004
Posts: 10467

PostPosted: Fri Aug 27, 2004 1:05 am    Post subject: Reply with quote

Although it's a good idea, testing shows that it's impossible with the features currently used by AutoHotkey. This is because BlockInput is a function built into the OS, and that function takes effect at a very low level (even lower than the keyboard and mouse hooks). Thus, there is no way for hotkeys to take effect.

However, an interesting note is that joystick hotkeys do work while BlockInput is on.
Back to top
View user's profile Send private message Send e-mail
Jon



Joined: 28 Apr 2004
Posts: 373

PostPosted: Fri Aug 27, 2004 10:35 pm    Post subject: Reply with quote

Quote:
In the same line, as an improvement suggestion for BlockInput:

During my script execution, I'd like to block user's input - mouse and keyb (like in BlockInput) but still let the user exit the script when pressing ESC or another predefined key or hotkey...
I think blocking all user's input is useful to avoid unexperienced users from getting in the way of an script during execution (e.g. prevent losing focus of applications the script is interacting with) but then again, allowing them to stop the script at their request (with ESC for example) would be handy when something wrong happens with the script or when the user wishes to terminate it before completion (for scripts that perform their "things" for a long time)
As I understand, the only way to stop a script which has blocked input is pressing CTRL+ALT+DEL and getting to the Task Manager to terminate the associated process. For unexperienced users, this could be difficult to handle and even dangerous.
Any thoughts on this?


You could add something like this to your code. It will exit the script and close task manager when you press CTRL+ALT+DEL

Code:
#Persistent

blockinput, On

SetTimer, getstate, 250

getstate:

getkeystate, state, delete, P

if state=D
{
winwait,  ahk_class #32770
winclose, ahk_class #32770
exitapp
}

Back to top
View user's profile Send private message Send e-mail
Display posts from previous:   
Post new topic   Reply to topic    AutoHotkey Community Forum Index -> Wish List All times are GMT
Page 1 of 1

 
Jump to:  
You can post new topics in this forum
You can reply to topics in this forum


Powered by phpBB © 2001, 2005 phpBB Group