This does no longer work in W10
Hanne4 opened this issue · 3 comments
I've tried the script, but nothing happens, except for the question "Hide the notification?". I'm using W10.
ActiveScript.ahk is An AutoHotkey script for hosting Active Scripting languages like VBScript and JScript. This is its reason for existing, not toast notifications. You should be more specific.
The Example_JsRT_Toast.ahk example script fails on v1709 because it does not provide a valid AppUserModelID. Apparently it was not required to be valid in some older versions.
For a desktop app to display a toast, the app must have a shortcut on the Start screen.
The shortcut must have an AppUserModelID.
Source: ToastNotificationManager Class
See if this works:
js.toast(toast_template, toast_image, toast_text
, "{6D809377-6AF0-444B-8957-A3773F02200E}\AutoHotkey\AutoHotkey.exe")
It will not work if you have not installed AutoHotkey. The GUID is apparently FOLDERID_ProgramFilesX64
, so it may require that you have installed AutoHotkey there.
You can get a list of AppUserModelIDs by running the Get-StartApps
PowerShell command. You can also create your own by creating a .lnk file in the Start menu. It ostensibly requires some COM code to set the AppUserModelID of the .lnk file, but apparently you can get away with an automatic one based on the target filename.
I replaced that line and it works again. I'm currently running Windows Version 10.0.16299 Build 16299.
Thanks for the info.
I'm not sure why this was left open, as it was fixed by commit 2482c26 (provided that a shortcut with the appropriate app ID exists in the Start menu).
I have tested it on more recent Windows 10 builds and had success without a "valid" app ID.
Testing on Windows 11 indicates that the app ID is not required to match an existing Start shortcut. If it matches a shortcut, the name and icon of the shortcut are displayed in the notification. Otherwise, the app ID itself is shown. With the current code, this means the leading part of a GUID is shown in the notification if AutoHotkey v1 is not installed. Changing the app ID to AutoHotkey.AutoHotkey
shows the name and icon of the (v2) shortcut in the notification. (The app ID of the shortcut is set by the v2 installer.)