Forum Discussion

mnsam's avatar
mnsam
Contributor
10 years ago
Solved

check the status of Call Sys.Desktop.Key

I wanted to check the status of Call Sys.Desktop.KeyDown(sInstrunctionvalue) and Call Sys.Desktop.KeyUp(sInstrunctionvalue) so, mainly to confirm that intended character was typed.
i tried using async call :

Set CallResultObj = Runner.CallObjectMethodAsync(Sys.Desktop,"Keydown",sInstrunctionvalue)
Set CallResultObj = Runner.CallObjectMethodAsync(Sys.Desktop,"KeyUp",sInstrunctionvalue)

however normal keyboard characters are not getting typed.

TC 10.30.1145

  • issue resolved, had not used ASCII conversation
    Runner.CallObjectMethodAsync(Sys.Desktop,"KeyUp",Asc(aqString.ToUpper(sInstructionValue)))

5 Replies

  • issue resolved, had not used ASCII conversation
    Runner.CallObjectMethodAsync(Sys.Desktop,"KeyUp",Asc(aqString.ToUpper(sInstructionValue)))

    • mnsam's avatar
      mnsam
      Contributor

      I have one more question regarding this,
      After the following code,

      While Not CallResultObj.Completed

          aqUtils.Delay 100
        WEnd

      The "CallResultObj.Completed" is True however,  "CallResultObj.ReturnValue" value is blank,
      1. so are we sure that TC has completed the operation of  "KeyUP" and "KeyDown" ?
      2. "CallResultObj.Completed" is True, is it because it has made a successful call to the sub/function ?  or is it because it has got a confirmation from the sub/function that it has been called and completed ?

      • HKosova's avatar
        HKosova
        SmartBear Alumni (Retired)

        KeyUp and KeyDown don't have a return value. These methods are synchronous, meaning they pause the test until they complete execution. So the code should be:

         

        Call Sys.Desktop.KeyDown(...)
        Call Sys.Desktop.KeyUp(...)

         

         

        Could you please clarify what you are trying to do exactly? If you need to input text into an object, you should use the Keys/SetText/wText or similar methods/properties of that specific object. For example:

         

        Call Sys.Process("notepad").Window("Notepad").Window("Edit").SetText("Hello")

        You can record your key presses to see which method and syntax to use.