Visual Basic Script - KeyPress Detection?
detection, keyboard, vbscript
Solution
This isn't possible in plain VBScript, but you may be able to get it to work with an HTA:
<head>
<title>Test</title>
<HTA:APPLICATION ID="oHTA"
APPLICATIONNAME="Test"
>
</head>
<script language="VBScript">
Sub CheckKey
If window.event.keyCode = 112 Then self.close()
End Sub
</script>
<body onKeyUp="CheckKey">
...
</body>
Problem
I want to terminate the program once the key F1 is pressed. Not sure sure how to write the do while loop. Any Ideas? ``` Set WshShell = WScript.CreateObject("WScript.Shell") Do While {F1} is not pressed '... Loop ```