Other information that will be collected are:
AppUserModelId
PackagePath
PackageFullName
PackageFamilyName
PackageName
PublisherId
Running this script outside the Appx/MSIX environment wil display empty values so you need to run it inside the AppX/MSIX environment. One easy way of doing this is to get the Microsoft MSIX Packaging Tool from the Microsoft Windows Store (the tool is free) and (re)package your compiled script or you can copy both the AutoHotkey64.exe and this script with the same name (AutoHotkey64.ahk) and place both of them in the same folder and create one or more entry points (shortcuts) for the AutoHotkey64.exe when creating a new MSIX Package.
Code: Select all
#Requires AutoHotkey v2.0
#SingleInstance off
#NoTrayIcon
; --------------------------------------------------------------- Collect AppX/MSIX Package Information ---------------------------------------------------------------
AppUserModelId := GetCurrentApplicationUserModelId(256)
If AppUserModelId
{
AppUserModelIdAppiD := StrSplit(AppUserModelId, "!")
AppId := AppUserModelIdAppiD[2]
}
Else
AppId := ""
PackagePath := GetCurrentPackagePath(256)
PackageFullName := GetCurrentPackageFullName(128)
PackageFamilyName := GetCurrentPackageFamilyName(128)
If PackageFamilyName
{
PackageNamePublisherId := StrSplit(PackageFamilyName, "_")
PackageName := PackageNamePublisherId[1]
PublisherId := PackageNamePublisherId[2]
}
Else
{
PackageName := ""
PublisherId := ""
}
MsgBox "PackagePath: " PackagePath "`nPackageFullName: " PackageFullName "`nPackageName: " PackageName "`nPublisherId: " PublisherId "`nPackageFamilyName: " PackageFamilyName "`nAppUserModelId: " AppUserModelId "`n`nApplication Id: " AppId, "MSIX Package Information", "iconi"
ExitApp 0
; --------------------------------------------------------------- Functions for Collecting AppX/MSIX Package Information ---------------------------------------------------------------
GetCurrentPackagePath(pathLength)
{
GetCurrentPackagePath := Buffer(pathLength, 0)
DllCall("GetCurrentPackagePath", "Wstr", pathLength, "Ptr", GetCurrentPackagePath)
GetPackagePath := StrGet(GetCurrentPackagePath)
Return GetPackagePath
}
GetCurrentPackageFullName(packageFullNameLength)
{
GetCurrentPackageFullName := Buffer(packageFullNameLength, 0)
DllCall("GetCurrentPackageFullName", "Wstr", packageFullNameLength, "Ptr", GetCurrentPackageFullName)
GetPackageFullName := StrGet(GetCurrentPackageFullName)
Return GetPackageFullName
}
GetCurrentPackageFamilyName(packageFamilyNameLength)
{
GetCurrentPackageFamilyName := Buffer(packageFamilyNameLength, 0)
DllCall("GetCurrentPackageFamilyName", "Wstr", packageFamilyNameLength, "Ptr", GetCurrentPackageFamilyName)
GetPackageFamilyName := StrGet(GetCurrentPackageFamilyName)
Return GetPackageFamilyName
}
GetCurrentApplicationUserModelId(applicationUserModelIdLength)
{
GetCurrentApplicationUserModelId := Buffer(applicationUserModelIdLength, 0)
DllCall("GetCurrentApplicationUserModelId", "Wstr", applicationUserModelIdLength, "Ptr", GetCurrentApplicationUserModelId)
GetAppUserModelId := StrGet(GetCurrentApplicationUserModelId)
Return GetAppUserModelId
}
https://learn.microsoft.com/en-us/windows/win32/api/appmodel/
https://learn.microsoft.com/en-us/windows/msix/overview