Forum Discussion

eykxas's avatar
eykxas
Frequent Contributor
8 years ago
Solved

Simulating Key Press

Hi,   I have a little problem. I want to simulate key press with Low Level.   I have this code :   function test(value){ var i = 0; for (;i < value.length; i++){ var chrK = value.charCo...
  • tristaanogre's avatar
    8 years ago

    That's because the KeyDown and KeyUp commands don't take the ASCII character string but the VK Code for the ascii character.  You need to call a Win32API method to get this to really work properly.  Something like

    function testlp(value){
      var i;
      for (i = 0; i < value.length; i++){
        var chrK = Win32API.VkKeyScan(value[i]);    
        LLPlayer.KeyDown(VK_SHIFT, 200);
        LLPlayer.KeyDown(chrK, 200);
        LLPlayer.KeyUp(chrK, 200);
        LLPlayer.KeyUp(VK_SHIFT, 200);
      }
    }