Friday, April 8, 2011

disabling user input

For example, if you are running Xibo for digital signage and don't want anyone to be able to close the program (or do anything on the computer).

Using AutoIT, the following script (which can be compiled to an .exe file) will block user input until a Notepad window is detected, which is just my way of saying BlockInput forever.

BlockInput(1)
WinWaitActive("Untitled - Notepad")


Unfortunately this does not block the "three finger salute" (Alt Ctrl Delete). Using AutoHotkey, which I am somewhat more familiar with, you can disable the task manager. Again this can be compiled into an executable.

; This script disables the task manager, and re-enables it with the key combination Windows + 1

Regwrite, REG_SZ, HKEY_LOCAL_MACHINE,SOFTWARE\Microsoft\Windows NT\CurrentVersion\Image File Execution Options\taskmgr.exe, Debugger, Hotkey Disabled
return

#1::
gosub Enable
return

Enable:
RegDelete,HKEY_LOCAL_MACHINE,SOFTWARE\Microsoft\Windows NT\CurrentVersion\Image File Execution Options\taskmgr.exe
return

ExitSub:
RegDelete,HKEY_LOCAL_MACHINE,SOFTWARE\Microsoft\Windows NT\CurrentVersion\Image File Execution Options\taskmgr.exe
ExitApp
return


And to call this compiled script from the AutoIt script that we first talked about:

BlockInput(1)
RunAs(username, @ComputerName, password, 2, DisableTaskManager.exe)
WinWaitActive("Untitled - Notepad")



Edit:
It seems that AutoIT has RegWrite and RegDelete functions, of course. I rewrite the script(s) accordingly.

No comments: