Page 1 of 1

[v2-Beta] - QuickLinks

Posted: 11 Nov 2021, 16:28
by AHK_user
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,
QuickLinks.png
QuickLinks.png (90.36 KiB) Viewed 5088 times
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

Re: [v2-Beta] - QuickLinks

Posted: 03 Nov 2022, 09:52
by dJeePe
Ok i'm may be late but great job :bravo:
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

Posted: 03 Nov 2022, 19:39
by Alguimist
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

Posted: 04 Nov 2022, 04:17
by think
Is there a v1 version of this function? Thanks.
Alguimist wrote:
03 Nov 2022, 19:39
You can use this function to retrieve the icon associated to file types:

Re: [v2-Beta] - QuickLinks

Posted: 05 Nov 2022, 18:49
by Alguimist
@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

Posted: 08 Nov 2022, 06:42
by dJeePe
Thank you @Alguimist

Re: [v2-Beta] - QuickLinks

Posted: 16 May 2023, 15:42
by likethevegetable
Just wondering if you have an update on this? Dark theme, perhaps?

Re: [v2-Beta] - QuickLinks

Posted: 20 May 2023, 02:56
by wernser412
It only reads one folder to me. It should read all folders.

Re: [v2-Beta] - QuickLinks

Posted: 20 May 2023, 09:35
by MrDodel
wernser412 wrote:
20 May 2023, 02:56
It only reads one folder to me. It should read all folders.
It would require limiting the depth of the folder tree you wish to dig or else you're in for a long wait.

Re: [v2-Beta] - QuickLinks

Posted: 22 May 2023, 12:59
by AHK_user
likethevegetable wrote:
16 May 2023, 15:42
Just wondering if you have an update on this? Dark theme, perhaps?
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

Posted: 22 May 2023, 13:01
by AHK_user
wernser412 wrote:
20 May 2023, 02:56
It only reads one folder to me. It should read all folders.
It is set to normally read the folder "Links" in the scriptdirectory, but you can change it.
It should normally also read the subfolders.

Re: [v2-Beta] - QuickLinks

Posted: 28 Aug 2023, 20:19
by Thoughtfu1Tux
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)
Amazing!!!! Thanks for the share!!
:bravo: :bravo: :bravo: :dance: :dance: :dance: :clap:

Re: [v2-Beta] - QuickLinks

Posted: 22 Sep 2023, 05:43
by n00b
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.

Re: [v2-Beta] - QuickLinks

Posted: 07 Nov 2023, 13:36
by cybernomad
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

Re: [v2-Beta] - QuickLinks

Posted: 07 Nov 2023, 15:06
by emp00
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

Re: [v2-Beta] - QuickLinks

Posted: 21 Nov 2023, 18:36
by HoldYourWaffle2
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...

Re: [v2-Beta] - QuickLinks

Posted: 22 Nov 2023, 15:19
by AHK_user
HoldYourWaffle2 wrote:
21 Nov 2023, 18:36
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...
Thanks
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 :D It is always good to learn from others.