-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMake-Toast.ps1
55 lines (45 loc) · 1.47 KB
/
Make-Toast.ps1
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
<#
.Synopsis
Short description
.DESCRIPTION
Long description
.EXAMPLE
Example of how to use this cmdlet
.EXAMPLE
Another example of how to use this cmdlet
#>
function Make-Toast
{
[CmdletBinding()]
[Alias()]
[OutputType([OutputType])]
Param
(
# Param1 help description
[Parameter(Mandatory = $true,
ValueFromPipeline = $true,
Position = 0)]
[String]
$Message,
[String]
$Title = 'PowerShell',
# Param2 help description
[int32]
$Seconds = 30
)
get-variable |? {$_.name -like "ps*"} | sort Name
write-verbose "`$PSCommandPath = $($PSCommandPath)"
#write-verbose "`$MyInvocation.MyCommand.Path = $($MyInvocation.MyCommand.Path)"
#write-verbose "`$MyInvocation.MyCommand.Path = $($MyInvocation.MyCommand.Path)"
$ScriptPath = split-path -path $PSCommandPath -Parent
write-verbose "`$ScriptPath = $($ScriptPath)"
[void] [System.Reflection.Assembly]::LoadWithPartialName("System.Windows.Forms")
$objNotifyIcon = New-Object System.Windows.Forms.NotifyIcon
test-path "$ScriptPath\powershell.ico"
$objNotifyIcon.Icon = "$ScriptPath\powershell.ico"
$objNotifyIcon.BalloonTipIcon = "info"
$objNotifyIcon.BalloonTipText = $Message
$objNotifyIcon.BalloonTipTitle = $Title
$objNotifyIcon.Visible = $True
$objNotifyIcon.ShowBalloonTip($($Seconds * 1000))
}