It is currently November 4th, 2024, 4:14 am

Windows Notification Toaster

Skins that control functions in Windows or Rainmeter
User avatar
kyriakos876
Posts: 919
Joined: January 30th, 2017, 2:01 am
Location: Greece

Re: Windows Notification Toaster

Post by kyriakos876 »

balala wrote: November 3rd, 2018, 9:20 pm As a side note, I'd add that at least as far as I can tell, the TemplateFilePath, the OutputFilePath and the DynamicVariables=1 options of the [MeasureLua] measure are useless. Even removing them, the code still works. In fact for example the Template.inc file (used into the TemplateFilePath option) doesn't even exist.
And one more, not related specifically to this thread, but to many others too: there is no need to include options into quotes. For example you don't need the quotes around the string passed into the Text option of the [MeterString] meter. Instead of Text="Click me to toast a notification", the Text=Click me to toast a notification form of the option works same well. The quoted option also works, but it's not needed.
Very common mistake (if it can be called mistake).
Yup... there's a lot of redundant stuff in the skin because I tried many things before ending up with something that works and I never took the little time to clear the code completely... Even the way I'm writing stuff in the .ps1 script is stupid...
Now, about the quotation stuff, For some reason I don't feel safe NOT using them almost everywhere where it's possible....

I will post an update with some code-clearing/simplification as well as more options for the notification and a better written .ps1 script!
(DynamicVariables=1 in the [MeasureLua] totally slipped though and I might not have seen it even during the clean-up :bow: )
User avatar
balala
Rainmeter Sage
Posts: 16699
Joined: October 11th, 2010, 6:27 pm
Location: Gheorgheni, Romania

Re: Windows Notification Toaster

Post by balala »

kyriakos876 wrote: November 3rd, 2018, 9:35 pm Yup... there's a lot of redundant stuff in the skin because I tried many things before ending up with something that works and I never took the little time to clear the code completely... Even the way I'm writing stuff in the .ps1 script is stupid...
Finally doesn't matter too much, because the code works as intended.
kyriakos876 wrote: November 3rd, 2018, 9:35 pm Now, about the quotation stuff, For some reason I don't feel safe NOT using them almost everywhere where it's possible....
You can use them as you want. They CAN be used, but ARE NOT NEEDED. As jsmorley wrote, they are needed when you set a new value for an option, with a !SetOption bang, but even there only if the newly set value has or can have spaces. But it's a good habit to use them, to get used to them.
User avatar
kyriakos876
Posts: 919
Joined: January 30th, 2017, 2:01 am
Location: Greece

Re: Windows Notification Toaster

Post by kyriakos876 »

So, I did some changes and added some things (see first post).
Took me a while to find that the Rainmeter's AppUserModelID is
{6D809377-6AF0-444B-8957-A3773F02200E}\Rainmeter\Rainmeter.exe
so now I call it from Rainmeter instead of powershell.
(I was using {6D809377-6AF0-444B-8957-A3773F02200E} alone for some reason :???: :confused: )
(Also removed some redundant stuff as reported by balala. Thanks for the side note ;-) )
I will probably add even more options later on...
User avatar
balala
Rainmeter Sage
Posts: 16699
Joined: October 11th, 2010, 6:27 pm
Location: Gheorgheni, Romania

Re: Windows Notification Toaster

Post by balala »

kyriakos876 wrote: November 3rd, 2018, 10:35 pm So, I did some changes and added some things (see first post).
Took me a while to find that the Rainmeter's AppUserModelID is
{6D809377-6AF0-444B-8957-A3773F02200E}\Rainmeter\Rainmeter.exe
so now I call it from Rainmeter instead of powershell.
(I was using {6D809377-6AF0-444B-8957-A3773F02200E} alone for some reason :???: :confused: )
(Also removed some redundant stuff as reported by balala. Thanks for the side note ;-) )
I will probably add even more options later on...
Very good, congratulations. It's even better then before.

Again a side note, I hope you don't mind. The skin can work even with no update at all. All this kind of mouse controlled skins can work so. Replacing the Update=1000 option of [Rainmeter] section with Update=-1 makes the skin not being updated at all, but this isn't even needed.
User avatar
jsmorley
Developer
Posts: 22898
Joined: April 19th, 2009, 11:02 pm
Location: Fort Hunt, Virginia, USA

Re: Windows Notification Toaster

Post by jsmorley »

As noted, by default an application using the notification system for the first time won't be "sticky" in the Action Center.

You will need to tell it to do so for "Rainmeter"

0.jpg
1.jpg

Without this change, it will only be in the Action Center as long as it is active.
You do not have the required permissions to view the files attached to this post.
User avatar
kyriakos876
Posts: 919
Joined: January 30th, 2017, 2:01 am
Location: Greece

Re: Windows Notification Toaster

Post by kyriakos876 »

I updated the first post with some documentations and added an option to change the ACTION of the button! Check the first post.
User avatar
kyriakos876
Posts: 919
Joined: January 30th, 2017, 2:01 am
Location: Greece

Re: Windows Notification Toaster

Post by kyriakos876 »

balala wrote: November 4th, 2018, 12:38 pm Very good, congratulations. It's even better then before.

Again a side note, I hope you don't mind. The skin can work even with no update at all. All this kind of mouse controlled skins can work so. Replacing the Update=1000 option of [Rainmeter] section with Update=-1 makes the skin not being updated at all, but this isn't even needed.
I will do that in the next updated. Thanks! It's those simple things that I miss everytime :D
jsmorley wrote: November 4th, 2018, 1:10 pm As noted, by default an application using the notification system for the first time won't be "sticky" in the Action Center.

You will need to tell it to do so for "Rainmeter"

Without this change, it will only be in the Action Center as long as it is active.
You are correct, I didn't notice that as I opened the action center the moment I send the notification, saw it there and I didn't think it would last as long as it's active. I will update the script to keep it without the user needing to change the settings. (I think I can do that)
User avatar
jsmorley
Developer
Posts: 22898
Joined: April 19th, 2009, 11:02 pm
Location: Fort Hunt, Virginia, USA

Re: Windows Notification Toaster

Post by jsmorley »

Note that if you execute the "action" while the notification is active, by clicking on the button, that will remove it from the Action Center. That is the desired behavior. The Action Center is kind of a "todo list", and taking the action removes it from the list.
User avatar
jsmorley
Developer
Posts: 22898
Joined: April 19th, 2009, 11:02 pm
Location: Fort Hunt, Virginia, USA

Re: Windows Notification Toaster

Post by jsmorley »

This would be a good candidate for a "plugin" is someone is feeling ambitious...
User avatar
kyriakos876
Posts: 919
Joined: January 30th, 2017, 2:01 am
Location: Greece

Re: Windows Notification Toaster

Post by kyriakos876 »

jsmorley wrote: November 4th, 2018, 1:21 pm This would be a good candidate for a "plugin" is someone is feeling ambitious...
I'd be glad to contribute. At the moment I'm trying to figure out how to escape the reserved characters in XML automatically. The only thing I can think of right now, is using lua's gsub.
If'd you care to help, it would be something like:

Code: Select all

name = "Hi & goodbye"
name = name:gsub("%&", "&")
This would return "Hi & goodbye"
but I don't know what would the syntax be for more characters... for example, if I had:

Code: Select all

name = "Hi & goodbye. My age is < than yours"
name = name:gsub( ???????? )
What would the gsub be in order to replace & with &amp; AND < with &lt; ?