Jump to content

How do I use BlockInput?


Recommended Posts

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

Link to comment
Share on other sites

  • 1 year later...

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
 Share

  • Recently Browsing   0 members

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