Forum Discussion

ekiza23's avatar
ekiza23
Contributor
11 years ago

Problem with 'Keys' method within Script Extensions

I have created a function to be in a Script Extension. In it, after entering some values in a text field, there is a call to click the "Enter" key



Call embeddableTextBoxWithUIPermissions.Keys(menuNumber)

Call Sys.Desktop.Keys("[Enter]")



When executing the function as is, it works just fine. But when I put it into the Script Extension and call it from my scripts, the value is typed into the text field, but the "Enter" command seems to be ignored.



I have also tried (to no avail)



Call embeddableTextBoxWithUIPermissions.Keys(menuNumber)

Call embeddableTextBoxWithUIPermissions.Keys("[Enter]")



and 



Call embeddableTextBoxWithUIPermissions.Keys(menuNumber & "[Enter]")



It always enters the menuNumber, so I know that the script extension is being called and the Keys function somehow works, but it seems to have troubles with the "[Enter]" part of it.



I am using TestComplete 9.31.3889.7 and the extensions and scripts are all in VBScript.



2 Replies

  • Hi Christian,

     


    I've checked in TestComplete 10.30 - everything works fine. Are you planning to update to the latest TC version?


     


    In the meantime, try using "/r/n" instead of "[Enter]"


     

  • AlexKaras's avatar
    AlexKaras
    Icon for Champion Level 2 rankChampion Level 2
    > the extensions and scripts are all in VBScript.

    > In the meantime, try using "/r/n" instead of "[Enter]"



    I think that in this case it is better to use the vbCr or vbCrLf VB constant (which equals to either Chr(13) or Chr(13) & Chr(10) correspondingly) instead of "/r/n"...