How to get File Location of Apps in Applications Folder??

Get help with using AutoHotkey (v1.1 and older) and its commands and hotkeys
jly
Posts: 89
Joined: 30 Sep 2020, 06:06

How to get File Location of Apps in Applications Folder??

14 Apr 2021, 03:22

I want to traverse the Applications Folder(AppsFolder) to get all apps inside,
and then get File Location if there is an item named "Open file location" in right-menu .


In my current script, I can only get the name and path (APPUserModelId) of an app.
I don’t know how to get the File Location ("Open file location"). Do you know how to get the File Location ??

Applications is a virtual folder, similar to This PC, Control Panel, Network, etc.,
it can be viewed by clicking in the Address Bar of Explorer & typing shell:AppsFolder

Code: Select all


oFolder := ComObjCreate("Shell.Application").NameSpace("shell:Appsfolder")
for item in oFolder.Items
{
	a1 .= item.name   "          -          "    item.path "`n"
}
oFolder =
MsgBox % a1

esc::ExitApp

Apps_File_Location2.png
Apps_File_Location2.png (84.64 KiB) Viewed 437 times
Attachments
Apps_File_Location.png
Apps_File_Location.png (173.99 KiB) Viewed 437 times
just me
Posts: 9442
Joined: 02 Oct 2013, 08:51
Location: Germany

Re: How to get File Location of Apps in Applications Folder??

14 Apr 2021, 04:52

Code: Select all

#NoEnv
KFI := "{7C5A40EF-A0FB-4BFC-874A-C0F2E0B9FA8E}"
MsgBox, % SHGetKnownFolderPath(KFI)
ExitApp
SHGetKnownFolderPath(KnownFolderID) {
   Path := ""
   VarSetCapacity(GUID, 16, 0)
   If !DllCall("Ole32.dll\CLSIDFromString", "WStr", KnownFolderID, "Ptr", &GUID, "Int")
   && !DllCall("Shell32.dll\SHGetKnownFolderPath", "Ptr", &GUID, "UInt", 0, "Ptr", 0, "PtrP", StrPtr, "Int") {
      Path := StrGet(StrPtr, "UTF-16")
      DllCall("Ole32.dll\CoTaskMemFree", "Ptr", StrPtr)
   }
   Return Path
}
?
jly
Posts: 89
Joined: 30 Sep 2020, 06:06

Re: How to get File Location of Apps in Applications Folder??

15 Apr 2021, 02:36

just me wrote:
14 Apr 2021, 04:52

Code: Select all

#NoEnv
KFI := "{7C5A40EF-A0FB-4BFC-874A-C0F2E0B9FA8E}"
MsgBox, % SHGetKnownFolderPath(KFI)
ExitApp
SHGetKnownFolderPath(KnownFolderID) {
   Path := ""
   VarSetCapacity(GUID, 16, 0)
   If !DllCall("Ole32.dll\CLSIDFromString", "WStr", KnownFolderID, "Ptr", &GUID, "Int")
   && !DllCall("Shell32.dll\SHGetKnownFolderPath", "Ptr", &GUID, "UInt", 0, "Ptr", 0, "PtrP", StrPtr, "Int") {
      Path := StrGet(StrPtr, "UTF-16")
      DllCall("Ole32.dll\CoTaskMemFree", "Ptr", StrPtr)
   }
   Return Path
}
?

hello just_me, thank you very much!
The function above gets the path corresponding to CLSID,
is there any function to get the path corresponding to AUMID(APPUserModelId)?

Return to “Ask for Help (v1)”

Who is online

Users browsing this forum: Exies, JoeWinograd, scriptor2016 and 102 guests