Hello! This is my first post here (even though I've been looking a lot into this forum and written some scripts ^^).
I made a library through which you can control the Windows Explorer programmatically. You can find the code on GitHub
The ExUtils class can control an explorer window, find out information about the current folder, items in folders, selected items, execute actions (verbs) on them and more. It also supports both Windows 10 and the Windows 11 Explorer Tabs
The code is has code comments in such a way that the AutoHotkey v2 Language Support Extension in VS Code can understand what types get returned and provide IntelliSense (it also describes the parameter options of most functions).
When I describe a tab, I mean both Windows 10 and Windows 11 because the Windows 10 explorer does theoretically have tabs, just one in one window![Very Happy :D]()
I will be working on automatically generating function documentation in the future so that it is easily possible to see the functionality of ExUtils.
The underlying ComObjects of the Tab, Folder, FolderItem etc. are wrapped in their own classes so you there can be extra functionality and good VS Code IntelliSense at the same time.
Examples
Copy the current path
Copies the path of the currently opened tab in Explorer and displays the copied paths in a tooltip
Open a new tab
Open a new tab with a path supplied (only works on Windows 11)
Edit the selected file (Calling the "edit" verb)
Gets the selected item and calls the "edit" verb on it
Navigate to a folder
Navigates to a folder by setting the Path property of ExUtils.Tab
Known problems
I am curious to get some feedback on what I could do differently (or some help with the above mentioned known problems ^^)
Cheers, Denis
I made a library through which you can control the Windows Explorer programmatically. You can find the code on GitHub
The ExUtils class can control an explorer window, find out information about the current folder, items in folders, selected items, execute actions (verbs) on them and more. It also supports both Windows 10 and the Windows 11 Explorer Tabs
The code is has code comments in such a way that the AutoHotkey v2 Language Support Extension in VS Code can understand what types get returned and provide IntelliSense (it also describes the parameter options of most functions).
When I describe a tab, I mean both Windows 10 and Windows 11 because the Windows 10 explorer does theoretically have tabs, just one in one window

I will be working on automatically generating function documentation in the future so that it is easily possible to see the functionality of ExUtils.
The underlying ComObjects of the Tab, Folder, FolderItem etc. are wrapped in their own classes so you there can be extra functionality and good VS Code IntelliSense at the same time.
Examples
Copy the current path
Copies the path of the currently opened tab in Explorer and displays the copied paths in a tooltip
CODE:
#Requires AutoHotkey v2
#Include "ExplorerUtils.ahk"
CopyCurrentPath() {
; get paths of selected items without quotes
items := ExUtils.SelectedItems() ; you can give an other explorer window handle if you want. Defaults to the current window
str := ""
if items.Length == 0 {
str := ExUtils.GetCurrentPath()
}
for item in items {
str .= (str ? '`n' : '') . item.Path
}
A_Clipboard := str
ToolTip("copied:`n" . str)
SetTimer(() => ToolTip(), -2000)
}
Open a new tab
Open a new tab with a path supplied (only works on Windows 11)
CODE:
#Requires AutoHotkey v2
#Include "ExplorerUtils.ahk"
OpenNewTab() {
ExUtils.GetCurrentExplorer().NewTab("C:\")
}
Edit the selected file (Calling the "edit" verb)
Gets the selected item and calls the "edit" verb on it
CODE:
#Requires AutoHotkey v2
#Include "ExplorerUtils.ahk"
EditFirstSelectedItem() {
selectedItems := ExUtils.GetActiveTab().SelectedItems
selectedItems[1].InvokeEdit()
}
Navigate to a folder
Navigates to a folder by setting the Path property of ExUtils.Tab
CODE:
#Requires AutoHotkey v2
#Include "ExplorerUtils.ahk"
Navigate() {
tab := ExUtils.GetActiveTab()
tab.Path := "C:\temp"
}
Known problems
- The method ExUtils.FolderItems.Filter() (filter a collection of FolderItem objects) does not work for some reason (at least on my machine). I have implemented it theoretically but my tests have not been successful.
- I have not a found a way to copy a FolderItems object, which makes for the following problem: When trying to use the ExUtils.Tab.SelectedItems property, the items will change if you navigate to another Tab
I am curious to get some feedback on what I could do differently (or some help with the above mentioned known problems ^^)
Cheers, Denis
Statistics: Posted by TheCrether — Today, 16:47