sending key to a window not very responsive
Moderators: JRL, Dorian (MJT support)
sending key to a window not very responsive
Hi. Although I did set focus to a specific window, sending keys to imitate the pressing of keys on a keyboard doesn't seem to be very responsive. For example, when I send key "q" while in a window, it make take it up to 5 tries and above, sometimes doesn't even register, before q is recognized in the program.
Really!? This is a new one on me. Please post a copy of your script and we'll see what might need changing to make it work reliably. Could just need a bit longer for the window to be ready before it can accept keyboard input.
MJT Net Support
[email protected]
[email protected]
- Bob Hansen
- Automation Wizard
- Posts: 2475
- Joined: Tue Sep 24, 2002 3:47 am
- Location: Salem, New Hampshire, US
- Contact:
re: the issue of waiting long enough after opening or setting focus to a window- would the right way be
first: SetFocus>window_title
WaitReady>
or second: WaitReady>
SetFocus>window_title
??
Thanks again for all the help jalbt51
PS the reason I ask such a basic question is that sometimes the wrong way WILL work Then one, thinking that the wrong way is the right way, will write faulty script that will cause a more important application later to crash.
first: SetFocus>window_title
WaitReady>
or second: WaitReady>
SetFocus>window_title
??
Thanks again for all the help jalbt51
PS the reason I ask such a basic question is that sometimes the wrong way WILL work Then one, thinking that the wrong way is the right way, will write faulty script that will cause a more important application later to crash.
- Bob Hansen
- Automation Wizard
- Posts: 2475
- Joined: Tue Sep 24, 2002 3:47 am
- Location: Salem, New Hampshire, US
- Contact:
I am sure you are opening up a debate here, which will be good for all of us.
As noted on an earlier posting today, these are my normal sequences:
As noted on an earlier posting today, these are my normal sequences:
I also have SK_DELAY=10 vs. default of 0.WaitWindowOpen>WindowName*
SetFocus>WindowName*
WaitReady>1
Hope this was helpful..................good luck,
Bob
A humble man and PROUD of it!
Bob
A humble man and PROUD of it!
Hi jalbt51,
There's no magic answer to your question. It all depends upon the actual situation. To help choose the right approach, you have to ask the following questions:
1. Will the script run without any intervention?
2. What kind of application? The script will be coded differently for MathCAD, ClipMagic, FileMaker, and Office Outlook 2003. For example, for Outlook 2003, SetFocus> takes relatively longer than ClipMagic to succeed.
3. Are there other applications running simultaneously?
4. How fast is your computer? The script intended for Pentium 3.4GHz with HT will be different than the one for AMD 300MHz.
If Microsoft Paint is the only application running, no SetFocus> is necessary.
For maximum assurance that the desired window is properly opend, I prefer GetRectCheckSum>. The disadvantage of using GetRectCheckSum> is it's relatively slow.
Good luck and happy scripting.
There's no magic answer to your question. It all depends upon the actual situation. To help choose the right approach, you have to ask the following questions:
1. Will the script run without any intervention?
2. What kind of application? The script will be coded differently for MathCAD, ClipMagic, FileMaker, and Office Outlook 2003. For example, for Outlook 2003, SetFocus> takes relatively longer than ClipMagic to succeed.
3. Are there other applications running simultaneously?
4. How fast is your computer? The script intended for Pentium 3.4GHz with HT will be different than the one for AMD 300MHz.
If Microsoft Paint is the only application running, no SetFocus> is necessary.
For maximum assurance that the desired window is properly opend, I prefer GetRectCheckSum>. The disadvantage of using GetRectCheckSum> is it's relatively slow.
Good luck and happy scripting.
About the original send key question: I've that found the following sort of thing works in Windows Paint.
Press CTRL
Send>v,r
wait>0.15
Release CTRL
SetFocus>Resize/Resample image*
wait>0.07
This particular one opens the resize dialog window in an already open IrfanView window
(there has to be an opened picture ready). The waits can be short(it depends on how busy and how fast your system is), but they do need to be there. Virtual events take longer. WHATEVER you do turn off those darn transition effects at DisplayProperties, Effects, use transition effects...
As far as WaitReady> goes, you'll have to ask the experts.
jalbt51
Press CTRL
Send>v,r
wait>0.15
Release CTRL
SetFocus>Resize/Resample image*
wait>0.07
This particular one opens the resize dialog window in an already open IrfanView window
(there has to be an opened picture ready). The waits can be short(it depends on how busy and how fast your system is), but they do need to be there. Virtual events take longer. WHATEVER you do turn off those darn transition effects at DisplayProperties, Effects, use transition effects...
As far as WaitReady> goes, you'll have to ask the experts.
jalbt51