Try a restart maybe? I've never gotten this behavior...
It is currently October 14th, 2024, 10:40 am
Windows Notification Toaster
-
- Posts: 919
- Joined: January 30th, 2017, 2:01 am
- Location: Greece
Re: Windows Notification Toaster
-
- Posts: 660
- Joined: June 25th, 2015, 7:02 pm
- Location: The Sky, USA
Re: Windows Notification Toaster
No luck...kyriakos876 wrote: ↑November 5th, 2018, 9:43 pm Try a restart maybe? I've never gotten this behavior...
-
- Posts: 919
- Joined: January 30th, 2017, 2:01 am
- Location: Greece
Re: Windows Notification Toaster
Try changing the 6th lιne of the ps1 script to:
Code: Select all
$app = '{1AC14E77-02E7-4E5D-B744-2EB1AE5198B7}\WindowsPowerShell\v1.0\powershell.exe'
-
- Posts: 40
- Joined: October 26th, 2016, 5:00 pm
Re: Windows Notification Toaster
Since you uses Powershell to trigger notification, I think you can use PowershellRM to do it natively, less overhead and take full advantage of Powershell utilities.
PowershellRM has integration with Rainmeter API so you can get Rainmeter variable value natively rather than using lua to find and replace.
I made some changes with your PS script to show how it works
Basically, I put creating XML template and notify method into a function called ToastIt.
In that function, I get and encode Rainmeter variable value with $RmAPI.VariableStr from PowershellRM and HtmlEncode from System.Web assembly, so we don't need Lua script to it for us or require users to encode by themeselves anymore.
We can now Show notification instantly after.
In skin INI, just simple use bang !CommandMeasure PSRM "ToastIt" to call ToastIt function we set up
You also can !SetVariable to change title/context/icon and toast new notification info on the fly without refreshing skin.
I packed new script and PowershellRM plugin here if you're interested in:
PowershellRM has integration with Rainmeter API so you can get Rainmeter variable value natively rather than using lua to find and replace.
I made some changes with your PS script to show how it works
Code: Select all
[Windows.UI.Notifications.ToastNotificationManager, Windows.UI.Notifications, ContentType = WindowsRuntime]
Add-Type -AssemblyName System.Web -IgnoreWarnings
$app = '{6D809377-6AF0-444B-8957-A3773F02200E}\Rainmeter\Rainmeter.exe'
$notify = [Windows.UI.Notifications.ToastNotificationManager]::CreateToastNotifier($app)
$ToastXml = New-Object -TypeName Windows.Data.Xml.Dom.XmlDocument
function EncodeVar {
param([string]$name)
$variableValue = $RmAPI.VariableStr($name)
return [System.Web.HttpUtility]::HtmlEncode($variableValue)
}
function ToastIt {
$TitleVar = EncodeVar('NotificationTitle')
$ContextVar = EncodeVar('NotificationContext')
$HeroImageVar = EncodeVar('NotificationTopImage')
$appLogoOverrideVar = EncodeVar('NotificationIcon')
$ButtonNameVar = EncodeVar('NotificationButtonName')
$ButtonActionVar = EncodeVar('NotificationButtonAction')
[xml]$ToastTemplate = @"
<toast launch="app-defined-string">
<visual>
<binding template="ToastGeneric">
<text>$TitleVar</text>
<text>$ContextVar</text>
<image placement="hero" src="$HeroImageVar"/>
<image placement="appLogoOverride" hint-crop="circle" src="$appLogoOverrideVar"/>
</binding>
</visual>
<actions>
<action content="$ButtonNameVar" arguments="$ButtonActionVar" activationType="protocol"/>
</actions>
</toast>
"@
$ToastXml.LoadXml($ToastTemplate.OuterXml)
$notify.Show($ToastXml)
}
In that function, I get and encode Rainmeter variable value with $RmAPI.VariableStr from PowershellRM and HtmlEncode from System.Web assembly, so we don't need Lua script to it for us or require users to encode by themeselves anymore.
We can now Show notification instantly after.
In skin INI, just simple use bang !CommandMeasure PSRM "ToastIt" to call ToastIt function we set up
You also can !SetVariable to change title/context/icon and toast new notification info on the fly without refreshing skin.
I packed new script and PowershellRM plugin here if you're interested in:
You do not have the required permissions to view the files attached to this post.
-
- Posts: 591
- Joined: February 28th, 2011, 3:20 pm
- Location: Vienna, Austria
Re: Windows Notification Toaster
@khanhas:
when i install your rmskin, i get a system-error "FileNotFound" for the plugin "PowershellRM".
At this place i use the portable version of Rainmeter. The rmskin correctly installs the plugin in the plugins directory of my portable version.
The gitHub-page of your plugin indicates ("...install the plugin in %appdata%\Rainmeter\Plugins), but that's not the place in a portable install.
Can this be the reason for the error?
when i install your rmskin, i get a system-error "FileNotFound" for the plugin "PowershellRM".
At this place i use the portable version of Rainmeter. The rmskin correctly installs the plugin in the plugins directory of my portable version.
The gitHub-page of your plugin indicates ("...install the plugin in %appdata%\Rainmeter\Plugins), but that's not the place in a portable install.
Can this be the reason for the error?
You do not have the required permissions to view the files attached to this post.
-
- Posts: 919
- Joined: January 30th, 2017, 2:01 am
- Location: Greece
Re: Windows Notification Toaster
I've made some improvements to the powershell script including using powershells functions to set the variables. This is my first time working with powershell scripts and XML so it'll get some trial and error to get to a simple and easy to use result. I will try the plugin to see if it helps. Though if what ikarus said above is true I won't be using it until the possibly location related issue has been resolved. Thanks!khanhas wrote: ↑November 6th, 2018, 6:34 am Since you uses Powershell to trigger notification, I think you can use PowershellRM to do it natively, less overhead and take full advantage of Powershell utilities.
PowershellRM has integration with Rainmeter API so you can get Rainmeter variable value natively rather than using lua to find and replace.
I will upload the updated skin when I've fixed something's the need fixing
-
- Posts: 40
- Joined: October 26th, 2016, 5:00 pm
Re: Windows Notification Toaster
@ikarus1969
Can you confirm that your Windows 7 has at least Powershell version 5.1?
1. Open up Powershell terminal
2. Run $psversiontable
Correct result should be: https://i.imgur.com/P6aCmr2.png
3. If you have any version lower than 5, try install this and restart: https://www.microsoft.com/en-us/download/details.aspx?id=54616
4. Hope it works out for you
Can you confirm that your Windows 7 has at least Powershell version 5.1?
1. Open up Powershell terminal
2. Run $psversiontable
Correct result should be: https://i.imgur.com/P6aCmr2.png
3. If you have any version lower than 5, try install this and restart: https://www.microsoft.com/en-us/download/details.aspx?id=54616
4. Hope it works out for you
-
- Posts: 591
- Joined: February 28th, 2011, 3:20 pm
- Location: Vienna, Austria
Re: Windows Notification Toaster
O man....it's the desktop at the office and we have version 2.0 (!) of powershell installed...(no chance to install any newer version)
I guess i have to wait until i'm home where everything is up-to-date.
Thank's for caring!
I guess i have to wait until i'm home where everything is up-to-date.
Thank's for caring!
You do not have the required permissions to view the files attached to this post.
-
- Posts: 40
- Joined: October 26th, 2016, 5:00 pm
Re: Windows Notification Toaster
I don't know if I get it right, but by the look of your window, I guess you're using Windows 7.
So upgrading Powershell might be resolve the problem but you won't able to use this skin since notification toast is Windows 10 only feature.
So upgrading Powershell might be resolve the problem but you won't able to use this skin since notification toast is Windows 10 only feature.
-
- Posts: 591
- Joined: February 28th, 2011, 3:20 pm
- Location: Vienna, Austria
Re: Windows Notification Toaster
Yes, you're right; i'm on Windows 7 here at the office.
So 2 version-problems here: powershell and windows