Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 4 of 4
  1. #1
    Banned
    Join Date
    Aug 2007
    Posts
    3
    Thanks
    0
    Thanked 0 Times in 0 Posts

    detecting a keystroke?

    so considering i know nothing about programming, could this be done in vbscript?
    would it be like pages of typing or is it simple

  • #2
    Supreme Master coder! Philip M's Avatar
    Join Date
    Jun 2002
    Location
    London, England
    Posts
    17,727
    Thanks
    202
    Thanked 2,507 Times in 2,485 Posts
    I expect it can be done in VBscript, but a simple JavaScript is

    <SCRIPT type = "text/javascript">
    document.onkeydown = function(ev) {
    var key;
    ev = ev || event;
    key = ev.keyCode;
    alert (key);
    }
    </SCRIPT>

  • #3
    Rockstar Coder
    Join Date
    Jun 2002
    Location
    USA
    Posts
    9,074
    Thanks
    1
    Thanked 328 Times in 324 Posts
    Quote Originally Posted by Philip M View Post
    I expect it can be done in VBscript, but a simple JavaScript is

    <SCRIPT type = "text/javascript">
    document.onkeydown = function(ev) {
    var key;
    ev = ev || event;
    key = ev.keyCode;
    alert (key);
    }
    </SCRIPT>
    Considering we are in the computer programming forum (assuming it wasn't moved here) I'd assume the OP was refering to VBScripts executing outside of a web browser.
    OracleGuy

  • #4
    Super Moderator
    Join Date
    May 2002
    Posts
    1,041
    Thanks
    0
    Thanked 12 Times in 12 Posts
    You could do it, you would just have to use the WSH in order to load the VBScript. But then you would want it to run in the background which would require a timer that would recycle and detect a keystroke, then take the appropriate action(s).

    -saige-
    HTML & CSS Forum Moderator

    "If you don't know what you think you know, then what do you know."
    R.I.P. Derrick Thomas #58
    1/1/1967 - 2/8/2000


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •