mirror of
https://github.com/fleschutz/PowerShell.git
synced 2024-12-28 01:28:50 +01:00
Update show-notifcation.ps1
This commit is contained in:
parent
b2c6f7ea22
commit
d6593816c3
@ -3,15 +3,21 @@
|
||||
Shows a notification
|
||||
.DESCRIPTION
|
||||
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
|
||||
PS> ./show-notification "Hello World"
|
||||
PS> ./show-notification
|
||||
.LINK
|
||||
https://github.com/fleschutz/PowerShell
|
||||
.NOTES
|
||||
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 {
|
||||
Add-Type -AssemblyName System.Windows.Forms
|
||||
@ -19,8 +25,8 @@ try {
|
||||
$path = (Get-Process -id $pid).Path
|
||||
$balloon.Icon = [System.Drawing.Icon]::ExtractAssociatedIcon($path)
|
||||
$balloon.BalloonTipIcon = [System.Windows.Forms.ToolTipIcon]::Info
|
||||
$balloon.BalloonTipText = $Text
|
||||
$balloon.BalloonTipTitle = $Title
|
||||
$balloon.BalloonTipText = $text
|
||||
$balloon.BalloonTipTitle = $title
|
||||
$balloon.Visible = $true
|
||||
$balloon.ShowBalloonTip($Duration)
|
||||
exit 0 # success
|
||||
|
Loading…
Reference in New Issue
Block a user