Forum Discussion

neens's avatar
neens
New Contributor
6 years ago

Press and hold 2 keys

In my desktop application I need to similate Alt and 1 keys pressed together and held for 3 seconds. Tried Key down and Key up, nothing worked. 

LLPlayer.KeyDown([VK_MENU][0x31], delay);

Delay(3000);

LLPlayer.KeyUp([VK_MENU][0x31], delay);

 

  • tristaanogre's avatar
    tristaanogre
    Esteemed Contributor

    Not sure why you have the additional numbers in place.  You should be able to just do

     

    LLPlayer.KeyDown(VK_MENU, 500)

    aqUtils.Delay(3000);

    LLPlayer.KeyUp(VK_MENU, 500)

    • neens's avatar
      neens
      New Contributor

      LLPlayer.KeyDown(VK_MENU, 500) is only for to press Alt key.

      I want to press and hold Alt and 1 key together for 3 seconds.

      Alt+1 press and hold I mean.

      • tristaanogre's avatar
        tristaanogre
        Esteemed Contributor

        You'll need to then make sure you include a KeyDown for the 1 key as well... you can't put two keys in the same KeyDown method.

         

        So

         

        LLPlayer.KeyDown(VK_MENU, 500)

        LLPlayer.KeyDown(31, 500)

        aqUtils.Delay(3000)

        LLPlayer.KeyUp(VK_MENU, 500)

        LLPlayer.KeyUp(31, 500)