In tip 6864, I introduced AutoIt freeware.
Using the AutoItX functionality, included with a Complete install, I have scripted BlockInput.bat to disable mouse and keyboard input for the number of seconds you specify.
The syntax for using BlockInput.bat is:
call BlockInput Seconds
NOTE: If Seconds starts with, or is, 0, any active block is terminated, restoring keyboard and mouse input.
NOTE: During the period that input is blocked, your script, and all other processes, will continue to process.
NOTE: BlockInput.bat uses Close.exe, which should be located in a folder that is in your PATH.
BlockInput.bat contains:
@echo off setlocal if \{%1\}==\{\} goto err if exist "%TEMP%\BlockInput.vbs" goto :block @echo set objArgs = WScript.Arguments>"%TEMP%\BlockInput.vbs" @echo Set oAutoIt = CreateObject("AutoItX.Control")>>"%TEMP%\BlockInput.vbs" @echo oAutoIt.BlockInput "On">>"%TEMP%\BlockInput.vbs" @echo WScript.Sleep objArgs(0)>>"%TEMP%\BlockInput.vbs" :block set sec=%1 set sec=%sec:"=% if "%sec:~0,1%" EQU "0" goto finish if exist "%TEMP%\BlockInput_%UserName%_%ComputerName%_*.CMD" del /q "%TEMP%\BlockInput_%UserName%_%ComputerName%_*.CMD" set wrk="%TEMP%\BlockInput_%UserName%_%ComputerName%_%RANDOM%.CMD" @echo @echo off>%wrk% @echo cscript //nologo "%TEMP%\BlockInput.vbs" %sec%000>>%wrk% @echo exit>>%wrk% start /min "BlockInput_%UserName%_%ComputerName%" %wrk% endlocal goto :EOF :finish call :Quiet>nul 2>&1 endlocal goto :EOF :Quiet close "BlockInput_%UserName%_%ComputerName%*" goto :EOF :err @echo Syntax: BlockInput Seconds endlocal
0 comments
Hide comments