4
1
Standard system Print dialog or Save dialog is swallowing keys sent immediately after opening. Is there a way how to send keys successfully as soon as possible?
Details:
Let's have some simple use case of Print dialog, i.e. if you press Ctrl+P in Internet Explorer. Once it opens, I just want to send Alt+p to press the Print button as soon as possible. But the following script does not work:
#IfWinActive, ahk_class IEFrame
F2::
Send ^p
WinWait, Print,, 2
Send !p ; this has no effect if sent immediately
Return
#IfWinActive
It starts working when I insert Sleep 500 before Send !p. But perhaps 500 ms won't be enough in some cases. Is there some ellegant way how to insert keystrokes ASAP?
Great, works! Maybe specifying
ahk_class #32770is little bit redundant – isn't it? – miroxlav – 2015-09-18T11:18:28.390I see the trick was is activation. Window is immediately presented as focused (active), but it seems that it actually isn't active yet. Activation solves the problem – miroxlav – 2015-09-18T11:22:15.003