mirror of
https://github.com/fleschutz/PowerShell.git
synced 2025-02-17 02:01:01 +01:00
Updated show-notification.ps1
This commit is contained in:
parent
1186432bb0
commit
b777d25888
@ -2,7 +2,7 @@
|
|||||||
.SYNOPSIS
|
.SYNOPSIS
|
||||||
Shows a notification
|
Shows a notification
|
||||||
.DESCRIPTION
|
.DESCRIPTION
|
||||||
This PowerShell script shows a toast-message notification for the Windows 10 Notification Center.
|
This PowerShell script shows a toast-message notification for the Windows Notification Center.
|
||||||
.PARAMETER text
|
.PARAMETER text
|
||||||
Specifies the text to show ('Hello World' by default)
|
Specifies the text to show ('Hello World' by default)
|
||||||
.PARAMETER title
|
.PARAMETER title
|
||||||
@ -10,14 +10,14 @@
|
|||||||
.PARAMETER duration
|
.PARAMETER duration
|
||||||
Specifies the view duration in milliseconds (5000 by default)
|
Specifies the view duration in milliseconds (5000 by default)
|
||||||
.EXAMPLE
|
.EXAMPLE
|
||||||
PS> ./show-notification
|
PS> ./show-notification.ps1
|
||||||
.LINK
|
.LINK
|
||||||
https://github.com/fleschutz/PowerShell
|
https://github.com/fleschutz/PowerShell
|
||||||
.NOTES
|
.NOTES
|
||||||
Author: Markus Fleschutz | License: CC0
|
Author: Markus Fleschutz | License: CC0
|
||||||
#>
|
#>
|
||||||
|
|
||||||
param([string]$text = "Hello World", [string]$title = "NOTE", [int]$Duration = 5000)
|
param([string]$text = "Hello World", [string]$title = "NOTE", [int]$duration = 5000)
|
||||||
|
|
||||||
try {
|
try {
|
||||||
Add-Type -AssemblyName System.Windows.Forms
|
Add-Type -AssemblyName System.Windows.Forms
|
||||||
@ -28,7 +28,7 @@ try {
|
|||||||
$balloon.BalloonTipText = $text
|
$balloon.BalloonTipText = $text
|
||||||
$balloon.BalloonTipTitle = $title
|
$balloon.BalloonTipTitle = $title
|
||||||
$balloon.Visible = $true
|
$balloon.Visible = $true
|
||||||
$balloon.ShowBalloonTip($Duration)
|
$balloon.ShowBalloonTip($duration)
|
||||||
exit 0 # success
|
exit 0 # success
|
||||||
} catch {
|
} catch {
|
||||||
"⚠️ Error in line $($_.InvocationInfo.ScriptLineNumber): $($Error[0])"
|
"⚠️ Error in line $($_.InvocationInfo.ScriptLineNumber): $($Error[0])"
|
||||||
|
Loading…
Reference in New Issue
Block a user