This code creates a menu based on a directory, so it is easy to change and manage without changing any code.
It also tries to get the correct Icons based on the extensions of the files.
This script is based on QuickLinks, by Jack Dunning, but with improvements so the level of submenus is unlimited.
Special thanks to @swagfag and @just me to help me translating the DLLCall, NumGet and Numput functions to the V2 version,
This current example has the mapkey Capslock to trigger the menu.
Latest updates:
- Splitted script from example
- Moved functions to the class QuickLinksMenu
- Removed some lines
Github
Download
[v2-Beta] - QuickLinks
[v2-Beta] - QuickLinks
Last edited by AHK_user on 22 Nov 2023, 15:16, edited 1 time in total.
Re: [v2-Beta] - QuickLinks
Ok i'm may be late but great job
I was looking for info about displaying a directory via a menu when i found this thread (FYI: I am making a subfoldeMmenu to browse faster in explorer [...])
However, displaying icons with RegRead doesn't work for me (privilege issues)
i'll try another way
I was looking for info about displaying a directory via a menu when i found this thread (FYI: I am making a subfoldeMmenu to browse faster in explorer [...])
However, displaying icons with RegRead doesn't work for me (privilege issues)
i'll try another way
Re: [v2-Beta] - QuickLinks
You can use this function to retrieve the icon associated to file types:
Code: Select all
GetFileIcon(File, SmallIcon := 1) {
Local hIcon
Static cbFileInfo := A_PtrSize + 688
SHFILEINFO := Buffer(cbFileInfo, 0)
DllCall("Shell32.dll\SHGetFileInfoW"
, "WStr", File
, "UInt", 0
, "Ptr" , SHFILEINFO
, "UInt", cbFileInfo
, "UInt", 0x100 | SmallIcon) ; SHGFI_ICON
hIcon := NumGet(SHFILEINFO, 0, "Ptr")
Return hIcon ? hIcon : LoadPicture("shell32.dll", "w16 h16 Icon1", &Type)
}
Re: [v2-Beta] - QuickLinks
@think: For AHK v1:
Code: Select all
GetFileIcon(File, SmallIcon := 1) {
Local hIcon, SHFILEINFO
Static cbFileInfo := A_PtrSize + 688
VarSetCapacity(SHFILEINFO, cbFileInfo, 0)
DllCall("Shell32.dll\SHGetFileInfoW"
, "WStr", File
, "UInt", 0
, "Ptr" , &SHFILEINFO
, "UInt", cbFileInfo
, "UInt", 0x100 | SmallIcon) ; SHGFI_ICON
hIcon := NumGet(SHFILEINFO, 0, "Ptr")
Return hIcon
? hIcon : LoadPicture("shell32.dll", "Icon1 w" . (SmallIcon ? "16" : "32"), Type)
}
Re: [v2-Beta] - QuickLinks
Thank you @Alguimist
-
- Posts: 81
- Joined: 05 May 2021, 08:54
Re: [v2-Beta] - QuickLinks
Just wondering if you have an update on this? Dark theme, perhaps?
- wernser412
- Posts: 14
- Joined: 10 Apr 2023, 21:08
Re: [v2-Beta] - QuickLinks
It only reads one folder to me. It should read all folders.
Re: [v2-Beta] - QuickLinks
It would require limiting the depth of the folder tree you wish to dig or else you're in for a long wait.
So much universe, and so little time. GNU Sir Terry.
Re: [v2-Beta] - QuickLinks
Darkmode menus can be used by adding the followin code on top:likethevegetable wrote: ↑16 May 2023, 15:42Just wondering if you have an update on this? Dark theme, perhaps?
Code: Select all
;https://stackoverflow.com/a/58547831/894589
uxtheme := DllCall("GetModuleHandle", "str", "uxtheme", "ptr")
SetPreferredAppMode := DllCall("GetProcAddress", "ptr", uxtheme, "ptr", 135, "ptr")
FlushMenuThemes := DllCall("GetProcAddress", "ptr", uxtheme, "ptr", 136, "ptr")
DllCall(SetPreferredAppMode, "int", 1) ; Dark
DllCall(FlushMenuThemes)
Re: [v2-Beta] - QuickLinks
It is set to normally read the folder "Links" in the scriptdirectory, but you can change it.
It should normally also read the subfolders.
- Thoughtfu1Tux
- Posts: 125
- Joined: 31 May 2018, 23:26
Re: [v2-Beta] - QuickLinks
Amazing!!!! Thanks for the share!!AHK_user wrote: ↑22 May 2023, 12:59
Darkmode menus can be used by adding the followin code on top:
Code: Select all
;https://stackoverflow.com/a/58547831/894589 uxtheme := DllCall("GetModuleHandle", "str", "uxtheme", "ptr") SetPreferredAppMode := DllCall("GetProcAddress", "ptr", uxtheme, "ptr", 135, "ptr") FlushMenuThemes := DllCall("GetProcAddress", "ptr", uxtheme, "ptr", 136, "ptr") DllCall(SetPreferredAppMode, "int", 1) ; Dark DllCall(FlushMenuThemes)
Re: [v2-Beta] - QuickLinks
thanks for the script.
1. the folder icons for special folders like desktop, documents, downloads, etc are neglected.
2. I miss the option to close the UI (ESC) in case I decide to cancel the operation.
1. the folder icons for special folders like desktop, documents, downloads, etc are neglected.
2. I miss the option to close the UI (ESC) in case I decide to cancel the operation.
-
- Posts: 1
- Joined: 07 Nov 2023, 13:32
Re: [v2-Beta] - QuickLinks
Sorry, still new
is there any way to send link to clipboard when you click on the link rather than opening file explorer? Or at least open a new tab if file explorer is already opened
is there any way to send link to clipboard when you click on the link rather than opening file explorer? Or at least open a new tab if file explorer is already opened
Re: [v2-Beta] - QuickLinks
Great solution! Can this be modified as such: When I press the hotkey (CapsLock)
- The script should grab the path of the currently open explorer window and show the QuickLinks-menu starting at the grabbed path
- If the active window is not an explorer window, it should open the QuickLinks-menu for a default path, e.g. C:\Users\Name
-
- Posts: 1
- Joined: 21 Nov 2023, 18:28
- Contact:
Re: [v2-Beta] - QuickLinks
This is a great piece of kit, thank you so much for sharing!
@AHK_user would you be willing to put the script on GitHub so the community could collaborate on improving it? A thread of forum posts generally isn't a super amazing medium for this.
I could do it myself, but it feels a bit wrong to implicitly take the credit...
@AHK_user would you be willing to put the script on GitHub so the community could collaborate on improving it? A thread of forum posts generally isn't a super amazing medium for this.
I could do it myself, but it feels a bit wrong to implicitly take the credit...
Re: [v2-Beta] - QuickLinks
ThanksHoldYourWaffle2 wrote: ↑21 Nov 2023, 18:36This is a great piece of kit, thank you so much for sharing!
@AHK_user would you be willing to put the script on GitHub so the community could collaborate on improving it? A thread of forum posts generally isn't a super amazing medium for this.
I could do it myself, but it feels a bit wrong to implicitly take the credit...
I moved the code to github and tried to do some improvements like moving it to a class and shortening some lines.
Feel free to propose improvements It is always good to learn from others.
Return to “Scripts and Functions (v2)”
Who is online
Users browsing this forum: No registered users and 21 guests