mirror of
https://github.com/fleschutz/PowerShell.git
synced 2024-12-28 17:48:59 +01:00
Update show-notifcation.ps1
This commit is contained in:
parent
b2c6f7ea22
commit
d6593816c3
@ -3,15 +3,21 @@
|
|||||||
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 10 Notification Center.
|
||||||
|
.PARAMETER text
|
||||||
|
Specifies the text to show ('Hello World' by default)
|
||||||
|
.PARAMETER title
|
||||||
|
Specifies the title to show ('NOTE' by default)
|
||||||
|
.PARAMETER duration
|
||||||
|
Specifies the view duration in milliseconds (5000 by default)
|
||||||
.EXAMPLE
|
.EXAMPLE
|
||||||
PS> ./show-notification "Hello World"
|
PS> ./show-notification
|
||||||
.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
|
||||||
@ -19,8 +25,8 @@ try {
|
|||||||
$path = (Get-Process -id $pid).Path
|
$path = (Get-Process -id $pid).Path
|
||||||
$balloon.Icon = [System.Drawing.Icon]::ExtractAssociatedIcon($path)
|
$balloon.Icon = [System.Drawing.Icon]::ExtractAssociatedIcon($path)
|
||||||
$balloon.BalloonTipIcon = [System.Windows.Forms.ToolTipIcon]::Info
|
$balloon.BalloonTipIcon = [System.Windows.Forms.ToolTipIcon]::Info
|
||||||
$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
|
||||||
|
Loading…
Reference in New Issue
Block a user