Sign in to follow this  
Followers 0
Aro2220

How do I use BlockInput?

5 posts in this topic

#1 ·  Posted (edited)

Hi!

I have a script that simulates mouse clicks and key strokes to automate tasks so I can use a hotkey to do them quicker.

The problem is that when these scripts are running if the user hits a button on the keyboard or clicks the mouse it will do things that the script wasn't prepared for.

I have heard of the function BlockInput but I can't get it to work.

I don't know if I have to include some kind of library (http://msdn.microsoft.com/en-us/library/ms646290%28VS.85%29.aspx) to get it to work in an autoit script but the pseudoscript below won't work for me (it functions the same as if the blockinput line was commented)

BlockInput(1) ;user should be unable to use the keyboard/mouse

Send("hello world")

Sleep (2000)

Send("is anyone there?")

BlockInput(0) ;user should now be able to use the keyboard/mouse

Sleep (2500)

Send("OH MY GOSH")

additionally, I run Windows 7 64

Edited by Aro2220

Share this post


Link to post
Share on other sites



That's odd. It works perfectly with me. It might be a bug in Windows 7. Try adding #RequireAdmin on start of your script.


I can do signature me.

Share this post


Link to post
Share on other sites

work fines for me to. i running windows xp if it matter.

Share this post


Link to post
Share on other sites

That's odd. It works perfectly with me. It might be a bug in Windows 7. Try adding #RequireAdmin on start of your script.

Thanks! #RequireAdmin was the problem. Windows 7 and I assume Vista probably block this function without that UAC box thing. Windows XP never had this feature so this makes sense.

Share this post


Link to post
Share on other sites

Just wondering if this would work with out admin rights as a need to run it on a network where my rights = 0


shutdown(1)

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