viewtopic.php?f=76&t=66133
I would like to retrieve the full path for the Downloads folder. I am aware of the linked solutions having been posted, but I am having a hard time translating this into v2 with all the DLL stuff... Can anybody help me out?
Get location of Downloads folder Topic is solved
Re: Get location of Downloads folder Topic is solved
Code: Select all
; This script gets the user's Downloads directory
#Requires AutoHotkey v2.0
downloads := downloadsDir()
MsgBox downloads, 'Downloads directory', 64
downloadsDir() {
; Adapted from teadrinker: https://www.autohotkey.com/boards/viewtopic.php?p=284248#p284248
; https://learn.microsoft.com/en-us/windows/win32/shell/csidl
; https://learn.microsoft.com/en-us/windows/win32/shell/knownfolderid
Static FOLDERID_Downloads := '{374DE290-123F-4565-9164-39C4925E467B}'
, keyName := 'HKCU\Software\Microsoft\Windows\CurrentVersion\Explorer\User Shell Folders'
, valueName := FOLDERID_Downloads
VarSetStrCapacity(&downloads, 261 << 1)
DllCall('ExpandEnvironmentStrings', 'Str', RegRead(keyName, valueName), 'Str', downloads, 'UInt', 260)
Return downloads
}
Re: Get location of Downloads folder
Awesome, thank you!