Note
Access to this page requires authorization. You can try signing in or changing directories.
Access to this page requires authorization. You can try changing directories.
Question
Monday, September 12, 2011 1:36 PM | 1 vote
I hope this is the right forum and I apologize for the very basic question.
I need to create a VBscript script to test keyboards.
The script should detect which key is pressed from the keyboard, including F keys; the script should start and when the user presses F2 should print something like "you pressed F2", when the user presses "A" should print "you pressed A", and so on.
Thank you for any hints.
Regards
marius
All replies (5)
Monday, September 12, 2011 2:08 PM âś…Answered | 1 vote
Hello Mario-Roma,
I hope this is the right forum and I apologize for the very basic question.
I need to create a VBscript script to test keyboards.
The script should detect which key is pressed from the keyboard, including F keys; the script should start and when the user presses F2 should print something like "you pressed F2", when the user presses "A" should print "you pressed A", and so on.
Thank you for any hints.
Regards
marius
to identify a button you can use the keyDown event of the form in question, in order to detect any key pressed, see example below.
Private Sub Form1_KeyDown(ByVal sender As System.Object, ByVal e As System.Windows.Forms.KeyEventArgs) Handles MyBase.KeyDown
If e.KeyCode.Equals(Keys.F2) Then
MessageBox.Show("Pressed F2")
End If
End Sub
Also remember to set it to true form of the KeyPreview property to true.
Regards.
Carmelo La Monica
Blog http://community.visual-basic.it/carmelolamonica/
WordPress http://carmelolamonica.wordpress.com/
Twitter http://twitter.com/carmelolamonica
Wednesday, April 2, 2014 4:56 PM
I believe Marius was asking for Visual Basic Script, not Visual Basic. Carmelo's answer is not a solution to Marius' request.
Wednesday, April 2, 2014 5:18 PM
I believe Marius was asking for Visual Basic Script, not Visual Basic. Carmelo's answer is not a solution to Marius' request.
This is a VB.Net forum, not a VB Script forum. Anyways, it must have answered Mario`s question because, Mario marked it as the answer. Many people confuse the two words and it looks like Mario may have done that. :)
Wednesday, February 28, 2018 7:48 PM
I believe Marius was asking for Visual Basic Script, not Visual Basic. Carmelo's answer is not a solution to Marius' request.
This is a VB.Net forum, not a VB Script forum. Anyways, it must have answered Mario`s question because, Mario marked it as the answer. Many people confuse the two words and it looks like Mario may have done that. :)
So, is imposible for VBS?
Wednesday, February 28, 2018 8:05 PM | 1 vote
I believe Marius was asking for Visual Basic Script, not Visual Basic. Carmelo's answer is not a solution to Marius' request.
This is a VB.Net forum, not a VB Script forum. Anyways, it must have answered Mario`s question because, Mario marked it as the answer. Many people confuse the two words and it looks like Mario may have done that. :)
So, is imposible for VBS?
I have no clue if it can be done in vbs but, if that is what you want to know then you need to ask in a vbs forum, not a VB.Net forum which this forum is for. 8)
If you say it can`t be done then i`ll try it