1
votes

I'm working with UFT- HP with VBScript language and trying to use the function micCapsLockOff that turns the caps lock off. The problem is that this fucntion sometimes works and sometimes not. Why is that? may you help?

Thanks...

Follows the code example:

For Index = 0 To 60 Step 1
If WpfWindow("window").Exist(0) Then
    WpfWindow("window").Activate
    WpfWindow("window").Type micCapsLockOff
    WpfWindow("window").Click
    End If
Next
1
Is this function not turning the caps lock off sometimes? Your code should work every time, i.e. it should turn off the caps lock. However, if the caps lock is already off - then it won't have any affect. May be you are forgetting to turn on the caps lock while testing your script. Just a guess though. - Pankaj Jaju
Hello Pankaj Jaju... Thanks for your comment, so I am aware about this and what I did is to every time that I was going to test I set the Caps Lock to On. But for any reason sometines it turns the caps lock off and sometimes not. - Jen
Hmm weird because there is nothing wrong with what you are trying to do with the script. Perhaps give some wait time before and after caps lock off. - Pankaj Jaju
Yes, I thought the same. What I did was to do a debug and then wait a little to then continue the execution to see if it works, but it did not. - Jen

1 Answers

0
votes

I got the solution, this is because I was debugging the code. When I just run it, it worked fine.