Jump to content

Recommended Posts

Posted

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

 

Posted

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

 

Posted

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.

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...