Page 1 of 2

how to send a message to the windows notification center?

Posted: Sun Aug 23, 2020 10:48 am
by A.D.
does anybody have a code to send a message to Window's notification center?

Regards
A.D.

Re: how to send a message to the windows notification center?

Posted: Fri Apr 30, 2021 3:54 pm
by A.D.
does nobody know how to do this?

Re: how to send a message to the windows notification center?

Posted: Fri Apr 30, 2021 4:34 pm
by GenRabbit
Dunno if I totally understand what you mean?
But if its to send a message to a window, you could use sendmessage_() or _sendMessage() I believe. This is a windows system call
more info here;
https://docs.microsoft.com/en-us/window ... endmessage

Re: how to send a message to the windows notification center?

Posted: Fri Apr 30, 2021 5:45 pm
by Marc56us
I think yo ask for the notifications panel on Windows 10 ? (Win +A)
Notifications on W10 taskbar (Balloon Tooltips or 'Toast notifications') can be added to notification panel after being closed.
(but I don't know how to)
:wink:

Re: how to send a message to the windows notification center?

Posted: Fri Apr 30, 2021 7:21 pm
by A.D.
yes, i mean the window 10 notification center on the right panel. Would be cool to have code for it!

Re: how to send a message to the windows notification center?

Posted: Fri Apr 30, 2021 7:41 pm
by RASHAD
Hi
Search the forum for System Tray Balloon by Michael Vogel (MV)

Re: how to send a message to the windows notification center?

Posted: Sat May 01, 2021 4:16 am
by A.D.
i'm looking for something like this https://github.com/deseven/pb-macos-notifications just for Windows 10! I think such toast notifications need to be declared as a Window 10 App to have access to the notification center.

Re: how to send a message to the windows notification center?

Posted: Sun May 02, 2021 12:10 am
by JHPJHP
Hi A.D.

Sent you a PM; original code can be found @ Windows Services & Other Stuff\Other_Stuff\PowerShell\ToastNotification\...

NOTE: Currently the code is to big to post as it uses base64 images.

Image

Re: how to send a message to the windows notification center?

Posted: Sun May 02, 2021 12:36 am
by BarryG
[Deleted; I don't know shit]

Re: how to send a message to the windows notification center?

Posted: Sun May 02, 2021 2:36 am
by JHPJHP
For basic notifications RASHAD is correct (System Tray Balloon).
But I thought the image I posted made it clear that Toast Notifications are different, and offer another level of messaging.

See the following XML and Toast Notification below:

NB*: I copied and pasted the XML into my existing example and the results were identical.

Code: Select all

<toast scenario="reminder">
  <visual>
    <binding template="ToastGeneric">
      <text>Windows 10 Semiannual Update 1809</text>
      <text>Required by 5:00 PM, Fri, 1/25/19</text>
      <text>You can visit Software Center at any time to view more details or install updates before the required deadline.</text>
      <image placement="hero" src="https://picsum.photos/364/180?image=1043"/>
    </binding>
  </visual>
  <actions>
    <input id="snoozeTime" type="selection" title="Click Snooze to be reminded in:" defaultInput="15">
      <selection id="15" content="15 minutes"/>
      <selection id="60" content="1 hour"/>
      <selection id="240" content="4 hours"/>
      <selection id="480" content="8 hours"/>
    </input>
    <action activationType="system" arguments="snooze" hint-inputId="snoozeTime" content=""/>
    <action activationType="system" arguments="dismiss" content=""/>
  </actions>
</toast>
Image

Re: how to send a message to the windows notification center?

Posted: Sun May 02, 2021 6:59 am
by BarryG
JHPJHP wrote: Sun May 02, 2021 2:36 amI thought the image I posted made it clear that Toast Notifications are different, and offer another level of messaging.
Oh, sorry, I didn't realise that image was an example toast notification. But yeah, you're right. Some notifications are more than just messages/balloon tips.

Re: how to send a message to the windows notification center?

Posted: Sun May 02, 2021 8:46 am
by Marc56us
It would be nice if someone could give a small, complete and functional example ("Hello World")

For information, with other tools like AutoIt, a simple

Code: Select all

TrayTip("Information", "Hello World!.", 30, 17)
... is enough to display a toast on Windows 10 ("title", "message", timeout, icon)
(but does not keep it in the notification center)

This is one of the easiest ways to get the user's attention in a program.
The advantage is also that you can't validate it by mistake by pressing enter like a modal box (MessageRequester)

Feature request for 5.74 :idea: :?:

:wink:

Re: how to send a message to the windows notification center?

Posted: Sun May 02, 2021 12:39 pm
by ChrisR
@JHPJHP
It didn't work the first time for me, Script execution is disabled here
But it worked fine after adding Set-executionpolicy unrestricted
It goes through Powershell but nice toast

Code: Select all

ProgramResult = RunProgram("powershell", "Set-executionpolicy unrestricted;" + #DQUOTE$ +   TemporaryDirectory + "_ToastNotification.ps1" + #DQUOTE$, #Null$, #PB_Program_Hide | #PB_Program_Open | #PB_Program_Read)

Re: how to send a message to the windows notification center?

Posted: Sun May 02, 2021 1:25 pm
by JHPJHP
Hi ChrisR,

Thank you for reporting the problem.

There already are Procedures to handle the Execution Policy (see RestorePoint.pbi), but I didn't think they were needed here.
The examples have been updated to set and restore the original Execution Policy; I believe RemoteSigned should be enough.

Re: how to send a message to the windows notification center?

Posted: Sun May 02, 2021 2:26 pm
by ChrisR
Hi JHPJHP,
It's all good with script execution disabled by default here :)