
Sistema estándarCuadro de diálogo ImprimiroGuardar cuadro de diálogoestá tragando las llaves enviadasinmediatamente después de la apertura. ¿Existe alguna forma de enviar claves correctamente lo antes posible?
Detalles:
Veamos un caso de uso simple del cuadro de diálogo Imprimir, es decir, si presiona Ctrl+ Pen Internet Explorer. Una vez que se abre, solo quiero enviar Alt+ ppara presionar elImprimirbotón tan pronto como sea posible. Pero el siguiente script no funciona:
#IfWinActive, ahk_class IEFrame
F2::
Send ^p
WinWait, Print,, 2
Send !p ; this has no effect if sent immediately
Return
#IfWinActive
Comienza a funcionar cuando lo inserto Sleep 500
antes Send !p
. Pero quizás 500 ms no sean suficientes en algunos casos. ¿Existe alguna forma elegante de insertar pulsaciones de teclas lo antes posible?
Respuesta1
#IfWinActive, ahk_class IEFrame
F2::
Send ^p
WinWait, Print ahk_class #32770 ; Waits until the specified window exists
IfWinNotActive, Print ahk_class #32770, ,WinActivate, Print ahk_class #32770
WinWaitActive, Print ahk_class #32770 ; Waits until the specified window is active
Send !p
Return
#IfWinActive
o
; WinWait, WinTitle, WinText, Seconds, ExcludeTitle, ExcludeText
WinWait, Print ahk_class #32770, WinText ; Use Window Spy to find out a single text element of the target window
IfWinNotActive, ...
...