Need to select a file in Windows Explorer. The following approach works but is slow. Takes at least 2-3 seconds for the window to appear (tried on several machines).
Code: Select all
Run Format("explorer.exe /select, `"{1}`"", path)
Code: Select all
Run Format("explorer.exe /select, `"{1}`"", path)
Thanks for answer. I don't have prior knowledge of which file to be selected, so can't run explorer earlier.
Code: Select all
#Requires AutoHotkey v2.0
nav
F3::nav(A_ScriptDir)
nav(dir := '') {
Static winTitle := 'ahk_class CabinetWClass'
If !WinExist(winTitle)
Run 'explorer'
If WinWait(winTitle,, 5) {
If dir {
WinActivate
For window in ComObject('Shell.Application').Windows
(WinActive('A') = window.Hwnd) && window.Navigate(dir)
} Else WinMinimize
} Else MsgBox 'An error occurred while waiting for the window.', 'Error', 48
}