copyleft Posted June 12, 2023 Posted June 12, 2023 Trying to write autoit script that opens app search prompt upon app execution then sends cursor to the app title bar if the escape key is pressed. #RequireAdmin #include <MsgBoxConstants.au3> Global $g_bEscPressed = False HotKeySet("{ESC}", "OnEscPressed") ShellExecute("C:\Windows\PowerRun.exe", "Myapp.exe") WinWait("Myapp", "") send ("^f") ;open app search prompt If $g_bEscPressed Then send ("!d"); goto app titlebar EndIf Exit Func OnEscPressed() $g_bEscPressed = True EndFunc ; end Exit
Andreik Posted June 12, 2023 Posted June 12, 2023 Something like this? #RequireAdmin #include <MsgBoxConstants.au3> Global $g_bEscPressed = False HotKeySet("{ESC}", "OnEscPressed") ShellExecute("C:\Windows\PowerRun.exe", "Myapp.exe") WinWait("Myapp", "") ; Here it would be nice to check if your window ; is active before sending ^f Send ("^f") ;open app search prompt Do Sleep(10) Until $g_bEscPressed ; Here it would be nice to check if your window ; is active before sending !d Send("!d"); goto app titlebar Func OnEscPressed() $g_bEscPressed = True EndFunc
copyleft Posted June 16, 2023 Author Posted June 16, 2023 Thanks. I think there's a conflict with a pre-assigned hotkey within the application because it won't go to the title bar now when the escape key is pressed. I just settled on an old-fashioned time out to get me to the title bar upon timeout expiration.
ioa747 Posted June 17, 2023 Posted June 17, 2023 Opt("GUICloseOnESC", 0) ;1=ESC closes, 0=ESC won't close I know that I know nothing
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now