Created
March 31, 2022 12:50
-
-
Save nyanhp/291d248f2a1f045df1206ec202c55f14 to your computer and use it in GitHub Desktop.
Tray Icon with PowerShell
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Tray Icon requires Assemblies | |
Add-Type -AssemblyName System.Drawing | |
Add-Type -AssemblyName System.Windows.Forms | |
$tipTimeout = New-TimeSpan -Seconds 10 | |
$trayIcon = [System.Windows.Forms.NotifyIcon]::new() | |
$trayIcon.Icon = [System.Drawing.Icon]::ExtractAssociatedIcon((Get-Process -Id $PID).Path) | |
$trayIcon.Text = "It Does things"; | |
$trayIcon.Visible = $true; | |
$trayIcon.BalloonTipTitle = "Hi $env:USERNAME!"; | |
$trayIcon.BalloonTipText = "This is a content text"; | |
$trayIcon.ShowBalloonTip($tipTimeout.TotalMilliseconds); | |
# Bereinigen | |
$trayIcon.Dispose() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment