vbscript >> disable keyboard and mouse while running script

by anVzdGxlYXJuaW4 » Sat, 02 Sep 2006 04:23:01 GMT

I know this is possible, but not sure how. I saw something on an exicutible
called doblock.exe, not sure where to find it. Any other ideas?

vbscript >> disable keyboard and mouse while running script

by jgarringer » Sat, 02 Sep 2006 10:58:30 GMT

Hi justlearnin,

You can do this with the AutoItX3 control available for free from
http://www.autoitscript.com . The only drawback to this solution is
that it can't be done by wsh natively. Once you install the AutoItX3
software you will need to register the autoitx3.dll file by opening a
command prompt and then changing directories to the location where you
installed AutoItX3. The .dll file you are looking for is installed in
the C:\Program Files\AutoIt3\AutoItX folder by default. (You will also
notice a handy help file in the same folder documenting the various
features of this add-on.)

After you have changed directories to the AutoItX folder type the
following command to
register the .dll file:

regsvr32.exe autoitx3.dll

You will get a message that the registration has succeeded. You don't
need to reboot.

Once this is done you can script this object.. here's an example that
might help.
The InputOff sub turns off keyboard and mouse input...the InputOn sub
turns them both back on again. The sleep statement between calling the
subs is simply to demonstate that you could put your own script code in
between the other two lines to get the same effect.

WScript.Sleep 10000 'replace this line with your own code

Sub InputOff
On Error Resume Next
Set objAutoIt = CreateObject("AutoItX3.Control")
If Err.Number = 0 Then
objAutoIt.BlockInput 1
End If
End Sub

Sub InputOn
On Error Resume Next
Set objAutoIt = CreateObject("AutoItX3.Control")
If Err.Number = 0 Then
objAutoIt.BlockInput 0
End If
End Sub


Hope this helps.

James Garringer

Similar Threads

1. Disabling the Mouse Click(esp left mouse)

My progrs.,

There is another problem i have with vb; i.e to disable the mouse click
esp the left mouse. I designed a form and I want the form only to
respond to the mouse click and outside this the mouse click should b
disabled. Thanx alot!


2. script that runs hidden and waits for mouse movement

3. Disable manual running of scripts?

Hi folks

I've tried to google the answer for this; maybe I just can't see for

I know that you can disable the running of VBS scripts that are
downloaded by web sites, embedded in emails, & so on.

What I can't find out, is this. In win98 or later, can you disable the
running of VBS scripts that are already on the local hard disk, and
that the user tries to run *deliberately*? (ie. by double-clicking the
VBS file, or a shortcut thereto)

Here's the background.

At present, users start my application by double-clicking a suitable
shortcut. For reasons not important here, I need to change the
shortcut to point to a VBS script. The VBS script will do a few
things, then *it* will start the application.

I'm concerned as to whether a general or administrative user, could
accidentally or deliberately configure his PC, to prevent the "manual"
running of VBS scripts from the local hard disk.

If that was possible, it would kill the change proposed above, since
it would stop my application starting. Ie. the shortcut would fail to
run the VBS script :-(


4. How to disable keyboard and mouse? - Access Forms

5. disabling mouse and keyboard

I have an application which should get inputs only through a touch screen 
For safety reason I want the mouse and keyboard to be totally disabled.
Is there a way through vba to achieve that?

6. "Run as" disables most keyboard input (IME)

7. disabling keyboard and mouse

Hi al!

Anyone who knows how to disable/enable the keyboard and mouse,
preferably from within a vbscript?

8. disable keyboard/mouse from vba for all programs? - Excel