Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Send a key to active window only
#1
I'll pick your brain probably one more time today..

I need to send the ENTER key but only to the specified active window. Sometimes this windows does not appear and my ENTER is sent to the next prompt, which causes a problem. Here is the code I used. It does set the focus properly, I only need to understand if I can put a condition on the ENTER key I send.

Code:
Copy      Help
OnScreenDisplay "Set the focus on the Old Inv prompt" 2 0 0 "" 0 0 1|4|128 "spla" 0 0
int w6=win("L-BOSS Confirm" "TMessageForm")
act w6
2
OnScreenDisplay "Answer YES to the prompt " 10 0 0 "" 0 0 1|4|128 "spla" 0 0
'Ay             ;; ALT+Y
10

Thanks.
#2
Macro Macro2875
Code:
Copy      Help
int w=wait(5 WA win("name")) ;;wait for the window max 5 s
err goto g1 ;;if no window after 5 s, skip Enter key
key Y ;;Enter
;g1
#3
This works and it's amazing, I can bypass a whole section that I (sometimes) didn't need to execute!

Thank you, the support here is awesome.


Forum Jump:


Users browsing this thread: 1 Guest(s)