
標準システム印刷ダイアログまたは保存ダイアログ飲み込んだキーが送信される開封直後できるだけ早くキーを正常に送信する方法はありますか?
詳細:
印刷ダイアログの簡単な使用例を見てみましょう。例えば、 Internet ExplorerでCtrl+を押した場合ですP。開いたら、Alt+pを送信して印刷できるだけ早くボタンをクリックしてください。ただし、次のスクリプトは機能しません。
#IfWinActive, ahk_class IEFrame
F2::
Send ^p
WinWait, Print,, 2
Send !p ; this has no effect if sent immediately
Return
#IfWinActive
Sleep 500
前に挿入すると動作を開始しますSend !p
。ただし、場合によっては 500 ミリ秒では不十分かもしれません。キーストロークをできるだけ早く挿入する優れた方法はありますか?
答え1
#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
または
; 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, ...
...