Hello Humans,
i have a little script and use the Traytip command. On windows 11, i get a toast notification. Thats fine. But the Title is the name of my Skript or if i compile the Skript it shows the name of the FileName as Title.
How can i modify that? Is that possible?
Who can teach me?
Best regards
Zak
[GUI] Traytip/Toast Notification Windows 10/11 - Title remove of modify Topic is solved
- ZakMcKrackenDE
- Posts: 11
- Joined: 28 Sep 2022, 07:48
Re: [GUI] Traytip/Toast Notification Windows 10/11 - Title remove of modify
Welcome to Windows11
See Toast notification structure (Attribution area)
- viewtopic.php?f=83&t=94044 (WiseGui by @SKAN) ahk_v2
- viewtopic.php?f=6&t=76881 (OSDTIP by @SKAN) ahk_l
- viewtopic.php?t=6056 (PleasantNotify by @Soft) ahk_l
Maybe Mister GDIP (@Hellbent) has someone done too
See Toast notification structure (Attribution area)
What you can do is use a custom notification:The attribution area is at the top of the toast notification. Starting with Windows 11, your app's name and icon are displayed in this area. The attribution area also includes a close button that allows the user to quickly dismiss the notification and an ellipses menu that allows the user to quickly disable notifications for your app or go to the Windows Settings page for your app's notifications. The attribution area is configured by the shell and can't be overridden in the toast XML payload, although your app can add items to the attribution area context menu.
- viewtopic.php?f=83&t=94044 (WiseGui by @SKAN) ahk_v2
- viewtopic.php?f=6&t=76881 (OSDTIP by @SKAN) ahk_l
- viewtopic.php?t=6056 (PleasantNotify by @Soft) ahk_l
Maybe Mister GDIP (@Hellbent) has someone done too
[AHK] v2.0.5 | [WIN] 11 Pro (Version 22H2) | [GitHub] Profile
- ZakMcKrackenDE
- Posts: 11
- Joined: 28 Sep 2022, 07:48
Re: [GUI] Traytip/Toast Notification Windows 10/11 - Title remove of modify
jNizM wrote: ↑28 Sep 2022, 08:35Welcome to Windows11
See Toast notification structure (Attribution area)
What you can do is use a custom notification:
- viewtopic.php?f=83&t=94044 (WiseGui by @SKAN) ahk_v2
- viewtopic.php?t=6056 (PleasantNotify by @Soft) ahk_l
Maybe Mister GDIP (@Hellbent) has someone done too
I like the toast notification, so its not a solution for me to use a custom one. Thanks for your fast answer.
Re: [GUI] Traytip/Toast Notification Windows 10/11 - Title remove of modify
Maybe it is somehow possible (https://learn.microsoft.com/en-us/uwp/api/windows.ui.notifications.toasttemplatetype?view=winrt-22000#fields) but I am not sure if lexikos can or will customize this
maybe with xaml (viewtopic.php?f=81&t=95945)
maybe with xaml (viewtopic.php?f=81&t=95945)
[AHK] v2.0.5 | [WIN] 11 Pro (Version 22H2) | [GitHub] Profile
Re: [GUI] Traytip/Toast Notification Windows 10/11 - Title remove of modify Topic is solved
At least you can compile your script and give it another name.Starting with Windows 11, your app's name and icon are displayed in this area.
[AHK] v2.0.5 | [WIN] 11 Pro (Version 22H2) | [GitHub] Profile
- FanaticGuru
- Posts: 1906
- Joined: 30 Sep 2013, 22:25
Re: [GUI] Traytip/Toast Notification Windows 10/11 - Title remove of modify
ZakMcKrackenDE wrote: ↑28 Sep 2022, 08:00i have a little script and use the Traytip command. On windows 11, i get a toast notification. Thats fine. But the Title is the name of my Skript or if i compile the Skript it shows the name of the FileName as Title.
How can i modify that? Is that possible?
I have some Toast_Notification code that I have used for years. I just now modified it to add a toast_addid parameter, before it just used the standard app id.
Code: Select all
F12::
Path_To_Picture := A_ScriptDir "\Outlook - Resource - Download Icon.png"
Toast_Notification(["This is Line 1","This is Line 2"], Path_To_Picture, "Title Here")
return
Esc::ExitApp
; #includes must be in Library
#Include <ActiveScript>
#Include <JsRT>
;~ ; Form of Function in AHK called with Toast Notification is Activated (clicked)
;~ ; Function must be named "AHK_ToastActivated"
AHK_ToastActivated(a)
{
MsgBox % a
}
Toast_Notification(toast_text, toast_image, toast_appid := "", toast_template := "toastImageAndText02" )
{
static
if !js
{
; Verify text and image
if !IsObject(toast_text)
toast_text := ["Text Parameter", "Must be an object."]
if !FileExist(toast_image)
{
MsgBox % "NOT FOUND`n" toast_image
return
}
; This assumes AutoHotkey is installed in the default location:
if !toast_appid ; Use Custom Title Instead of Default App ID
toast_appid := (A_Is64bitOS ? "{6D809377-6AF0-444b-8957-A3773F02200E}"
: "{905e63b6-c1bf-494e-b29c-65b732d3d21a}")
. "\AutoHotkey\AutoHotkey.exe"
; Only the Edge version of JsRT supports WinRT.
js := new JsRT.Edge
js.AddObject("JS_ToastActivated", Func("AHK_ToastActivated"))
; Enable use of WinRT. "Windows.UI" or "Windows" would also work.
js.ProjectWinRTNamespace("Windows.UI.Notifications")
code =
(
function toast(template, image, text, app) {
// Alias for convenience.
var N = Windows.UI.Notifications;
// Get the template XML as an XmlDocument.
var toastXml = N.ToastNotificationManager.getTemplateContent(N.ToastTemplateType[template]);
// Create toastNode to launch on click
var toastNode = toastXml.selectSingleNode('/toast');
toastNode.setAttribute('launch', text[1]);
// Insert our content.
var i = 0;
for (let el of toastXml.getElementsByTagName("text")) {
if (typeof text == 'string') {
el.innerText = text;
break;
}
el.innerText = text[++i];
}
toastXml.getElementsByTagName("image")[0].setAttribute("src", image);
// Show the notification.
var toastNotifier = N.ToastNotificationManager.createToastNotifier(app || "AutoHotkey");
var notification = new N.ToastNotification(toastXml);
notification.addEventListener("activated", toastActivatedHandler);
toastNotifier.show(notification);
}
function toastActivatedHandler(a) {
JS_ToastActivated(a.arguments);
}
)
try
{
; Define the toast function.
js.Exec(code)
}
catch ex
{
try errmsg := ex.stack
if !errmsg
errmsg := "Error: " ex.message
MsgBox % errmsg
}
}
try
{
; Show a toast notification.
js.toast(toast_template, toast_image, toast_text, toast_appid)
}
catch ex
{
try errmsg := ex.stack
if !errmsg
errmsg := "Error: " ex.message
MsgBox % errmsg
}
}
I have not tested this hardly any but it seems to work.
I may have to change the version in my library. I need to think about the best order for the parameters which will probably break all my scripts that use it unless I make it the last optional parameter.
FG
Hotkey Help - Help Dialog for Currently Running AHK Scripts
AHK Startup - Consolidate Multiply AHK Scripts with one Tray Icon
Hotstring Manager - Create and Manage Hotstrings
[Class] WinHook - Create Window Shell Hooks and Window Event Hooks
AHK Startup - Consolidate Multiply AHK Scripts with one Tray Icon
Hotstring Manager - Create and Manage Hotstrings
[Class] WinHook - Create Window Shell Hooks and Window Event Hooks
Re: [GUI] Traytip/Toast Notification Windows 10/11 - Title remove of modify
The app ID of a toast notification isn't supposed to be a displayable title, but an Application User Model ID. It is used for purposes other than display, such as persisting the notification settings (allowing the user to turn them off).
Normally the app ID should correspond to the app ID of an installed app or shortcut in the Start menu. For instance, the AutoHotkey v2 installer creates a shortcut with the app ID "AutoHotkey.AutoHotkey", and the winrt.ahk/toast.ahk example (for v2) uses this same ID, so the notification displays the app name as simply "AutoHotkey".
For desktop apps, there does not appear to be any restriction on the ID. If I specify "Microsoft.Windows.ControlPanel" for instance, the notification will show "Control Panel" (with the appropriate icon). IDs can be found by using one of the methods in the following article: Find the Application User Model ID of an installed app - Configure Windows | Microsoft Learn.
Shortcuts without an explicit app ID generally have an implicit one based on the path of the shortcut's target, so you could probably use FileCreateShortcut to create a shortcut with whatever name and icon you want.
Normally the app ID should correspond to the app ID of an installed app or shortcut in the Start menu. For instance, the AutoHotkey v2 installer creates a shortcut with the app ID "AutoHotkey.AutoHotkey", and the winrt.ahk/toast.ahk example (for v2) uses this same ID, so the notification displays the app name as simply "AutoHotkey".
For desktop apps, there does not appear to be any restriction on the ID. If I specify "Microsoft.Windows.ControlPanel" for instance, the notification will show "Control Panel" (with the appropriate icon). IDs can be found by using one of the methods in the following article: Find the Application User Model ID of an installed app - Configure Windows | Microsoft Learn.
Shortcuts without an explicit app ID generally have an implicit one based on the path of the shortcut's target, so you could probably use FileCreateShortcut to create a shortcut with whatever name and icon you want.