31 lines
979 B
PowerShell
31 lines
979 B
PowerShell
# Usage: alert <message="Alert"> (<type=Information/None/Error/Question/Warning> (<Buttons=OK/OKCancel/YesNoCancel/YesNo>))
|
|
|
|
# HELP HANDLE
|
|
if($args[0] -eq 'h' -or $args[0] -eq '-h' -or $args[0] -eq 'H' -or $args[0] -eq '-H' -or $args[0] -eq 'help' -or $args[0] -eq 'Help' -or $args[0] -eq 'HELP') {
|
|
Write-Host "Usage: alert <message=Alert> (<type=Information/None/Error/Question/Warning> (<Buttons=OK/OKCancel/YesNoCancel/YesNo>))`nalert h/-h/help/etc: Display this help message"
|
|
exit
|
|
}
|
|
|
|
# MESSAGE HANDLE DEFAULT
|
|
if([string]::IsNullOrEmpty($args[0])) {
|
|
$Message = "Alert"
|
|
} else {
|
|
$Message = $args[0]
|
|
}
|
|
|
|
# TYPE HANDLE DEFAULT
|
|
if([string]::IsNullOrEmpty($args[1])) {
|
|
$Type = "Information"
|
|
} else {
|
|
$Type = $args[1]
|
|
}
|
|
|
|
# BUTTONS HANDLE DEFAULT
|
|
if([string]::IsNullOrEmpty($args[2])) {
|
|
$Buttons = "OK"
|
|
} else {
|
|
$Buttons = $args[2]
|
|
}
|
|
|
|
Add-Type -AssemblyName PresentationFramework
|
|
[System.Windows.MessageBox]::Show($Message, $Message, $Buttons, $Type); |