[v2-Beta] - QuickLinks

Post your working scripts, libraries and tools.
AHK_user
Posts: 515
Joined: 04 Dec 2015, 14:52
Location: Belgium

[v2-Beta] - QuickLinks

11 Nov 2021, 16:28

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 4895 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
Last edited by AHK_user on 22 Nov 2023, 15:16, edited 1 time in total.
User avatar
dJeePe
Posts: 20
Joined: 21 Oct 2022, 08:53

Re: [v2-Beta] - QuickLinks

03 Nov 2022, 09:52

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
User avatar
Alguimist
Posts: 428
Joined: 05 Oct 2015, 16:41
Contact:

Re: [v2-Beta] - QuickLinks

03 Nov 2022, 19:39

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)
}
think
Posts: 137
Joined: 09 Feb 2014, 05:20

Re: [v2-Beta] - QuickLinks

04 Nov 2022, 04:17

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:
User avatar
Alguimist
Posts: 428
Joined: 05 Oct 2015, 16:41
Contact:

Re: [v2-Beta] - QuickLinks

05 Nov 2022, 18:49

@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)
}
User avatar
dJeePe
Posts: 20
Joined: 21 Oct 2022, 08:53

Re: [v2-Beta] - QuickLinks

08 Nov 2022, 06:42

Thank you @Alguimist
likethevegetable
Posts: 81
Joined: 05 May 2021, 08:54

Re: [v2-Beta] - QuickLinks

16 May 2023, 15:42

Just wondering if you have an update on this? Dark theme, perhaps?
User avatar
wernser412
Posts: 14
Joined: 10 Apr 2023, 21:08

Re: [v2-Beta] - QuickLinks

20 May 2023, 02:56

It only reads one folder to me. It should read all folders.
User avatar
MrDodel
Posts: 96
Joined: 28 Apr 2021, 09:03
Location: Event Horizon

Re: [v2-Beta] - QuickLinks

20 May 2023, 09:35

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.
So much universe, and so little time. GNU Sir Terry.
AHK_user
Posts: 515
Joined: 04 Dec 2015, 14:52
Location: Belgium

Re: [v2-Beta] - QuickLinks

22 May 2023, 12:59

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)
AHK_user
Posts: 515
Joined: 04 Dec 2015, 14:52
Location: Belgium

Re: [v2-Beta] - QuickLinks

22 May 2023, 13:01

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.
User avatar
Thoughtfu1Tux
Posts: 125
Joined: 31 May 2018, 23:26

Re: [v2-Beta] - QuickLinks

28 Aug 2023, 20:19

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:
n00b
Posts: 29
Joined: 24 May 2016, 16:42

Re: [v2-Beta] - QuickLinks

22 Sep 2023, 05:43

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.
cybernomad
Posts: 1
Joined: 07 Nov 2023, 13:32

Re: [v2-Beta] - QuickLinks

07 Nov 2023, 13:36

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
emp00
Posts: 158
Joined: 15 Apr 2023, 12:02

Re: [v2-Beta] - QuickLinks

07 Nov 2023, 15:06

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
HoldYourWaffle2
Posts: 1
Joined: 21 Nov 2023, 18:28
Contact:

Re: [v2-Beta] - QuickLinks

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...
AHK_user
Posts: 515
Joined: 04 Dec 2015, 14:52
Location: Belgium

Re: [v2-Beta] - QuickLinks

22 Nov 2023, 15:19

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.

Return to “Scripts and Functions (v2)”

Who is online

Users browsing this forum: No registered users and 21 guests