Highlight a Folder (by Name or Path) in the active Windows 10 Explorer window Topic is solved
Highlight a Folder (by Name or Path) in the active Windows 10 Explorer window
How do I Highlight an existing Folder (using it's Name or Path) in the active Windows 10 Explorer window?
Re: Highlight a Folder (by Name or Path) in the active Windows 10 Explorer window
try this:
Code: Select all
filepath := "C:\Users\User\Desktop\YourFile.txt"
Run, % "explorer /select, " filepath
Explorer docs for more info
-TL
Re: Highlight a Folder (by Name or Path) in the active Windows 10 Explorer window
- Some ideas (set the focus/selection):
Explorer window interaction (folder windows/Desktop, file/folder enumeration/selection/navigation/creation) - AutoHotkey Community
https://autohotkey.com/boards/viewtopic.php?f=6&t=35041
- Nice link Tigerlily. Cheers.
Explorer window interaction (folder windows/Desktop, file/folder enumeration/selection/navigation/creation) - AutoHotkey Community
https://autohotkey.com/boards/viewtopic.php?f=6&t=35041
- Nice link Tigerlily. Cheers.
homepage | tutorials | wish list | fun threads | donate
WARNING: copy your posts/messages before hitting Submit as you may lose them due to CAPTCHA
WARNING: copy your posts/messages before hitting Submit as you may lose them due to CAPTCHA
Re: Highlight a Folder (by Name or Path) in the active Windows 10 Explorer window
Tigerlily,
Thanks for the response.
I wanted to highlight the folder (filepath) in the ACTIVE (already existing) Explorer window, if possible.
Run, % "explorer /select, " filepath ... opens a NEW Explorer window (does NOT use the existing window).
If you know how to select the file in the existing Explorer window (I have the title & wHandle), I would appreciate it.
Thank You
Jack
Thanks for the response.
I wanted to highlight the folder (filepath) in the ACTIVE (already existing) Explorer window, if possible.
Run, % "explorer /select, " filepath ... opens a NEW Explorer window (does NOT use the existing window).
If you know how to select the file in the existing Explorer window (I have the title & wHandle), I would appreciate it.
Thank You
Jack
Re: Highlight a Folder (by Name or Path) in the active Windows 10 Explorer window
easy
First, get the information
Now, close it
Lastly, open it with the information you have as above mentioned tips
right ?
First, get the information
Now, close it
Lastly, open it with the information you have as above mentioned tips
right ?
Re: Highlight a Folder (by Name or Path) in the active Windows 10 Explorer window
Klarion,
Thank you, but I already knew how to make Tigerlily's code work, unfortunately, I want to use the active window not a new one.
There are many reasons, including, the active windows set up, screen location, etc. which are being controlled by other programs.
Yes, all of these can be redone to the new window but I would prefer not to reinvent the wheel here.
If there is a simple way to highlight the folder name specified in the active explorer window, great, if not, it is not worth the time and effort to change my code to work with a the new window.
Thank You
Jack
Thank you, but I already knew how to make Tigerlily's code work, unfortunately, I want to use the active window not a new one.
There are many reasons, including, the active windows set up, screen location, etc. which are being controlled by other programs.
Yes, all of these can be redone to the new window but I would prefer not to reinvent the wheel here.
If there is a simple way to highlight the folder name specified in the active explorer window, great, if not, it is not worth the time and effort to change my code to work with a the new window.
Thank You
Jack
Re: Highlight a Folder (by Name or Path) in the active Windows 10 Explorer window Topic is solved
In the link posted by jeeswg you can find the Function which set the focus in the current Explorer window.
Usage:
press q to hilight the requested file or folder.
press esc to exit.
Usage:
press q to hilight the requested file or folder.
press esc to exit.
Code: Select all
;~ From : ;~ https://www.autohotkey.com/boards/viewtopic.php?f=6&t=35041
#SingleInstance, force
#Persistent
~q::
JEE_ExpWinSetFoc(0, "NameOfyourFileOrFolder")
return
ExitApp
JEE_ExpWinSetFoc(hWnd, vName, vByPos:=0, vFlags:=0x1D)
{
local oItems, oWin, oWindows, vWinClass
DetectHiddenWindows, On
(!hWnd) && hWnd := WinExist("A")
WinGetClass, vWinClass, % "ahk_id " hWnd
if (vWinClass = "CabinetWClass") || (vWinClass = "ExploreWClass")
{
for oWin in ComObjCreate("Shell.Application").Windows
if (oWin.HWND = hWnd)
break
}
else if (vWinClass = "Progman") || (vWinClass = "WorkerW")
{
oWindows := ComObjCreate("Shell.Application").Windows
VarSetCapacity(hWnd, 4, 0)
;SWC_DESKTOP := 0x8 ;VT_BYREF := 0x4000 ;VT_I4 := 0x3 ;SWFO_NEEDDISPATCH := 0x1
oWin := oWindows.FindWindowSW(0, "", 8, ComObject(0x4003, &hWnd), 1)
}
else
return
oItems := oWin.Document.Folder.Items
;SVSI_FOCUSED = 0x10 ;SVSI_ENSUREVISIBLE := 0x8
;SVSI_DESELECTOTHERS := 0x4 ;SVSI_EDIT := 0x3
;SVSI_SELECT := 0x1 ;SVSI_DESELECT := 0x0
if !vByPos
oWin.Document.SelectItem(oItems.Item(vName), vFlags)
else
oWin.Document.SelectItem(oItems.Item(vName-1), vFlags)
oWindows := oWin := oItems := ""
}
esc::
ExitApp
____________________________________________________________________________
Windows 10 Pro 64 bit - Autohotkey v1.1.30.01 64-bit Unicode
Windows 10 Pro 64 bit - Autohotkey v1.1.30.01 64-bit Unicode
Re: Highlight a Folder (by Name or Path) in the active Windows 10 Explorer window
Odlanir,
Thank you for the code.
I added; JEE_ExpWinSetFoc(0, "NameOfyourFileOrFolder") to my code (no hotkey)
and the function; JEE_ExpWinSetFoc(hWnd, vName, vByPos:=0, vFlags:=0x1D)
It works exactly as I had hoped.
Thanks again.
Jack
Thank you for the code.
I added; JEE_ExpWinSetFoc(0, "NameOfyourFileOrFolder") to my code (no hotkey)
and the function; JEE_ExpWinSetFoc(hWnd, vName, vByPos:=0, vFlags:=0x1D)
It works exactly as I had hoped.
Thanks again.
Jack
Re: Highlight a Folder (by Name or Path) in the active Windows 10 Explorer window
Nice, but you should tank jeeswg who is the author.
____________________________________________________________________________
Windows 10 Pro 64 bit - Autohotkey v1.1.30.01 64-bit Unicode
Windows 10 Pro 64 bit - Autohotkey v1.1.30.01 64-bit Unicode
Who is online
Users browsing this forum: AdsBot [Google], Spawnova and 109 guests