-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathacheievement.ps1
38 lines (35 loc) · 930 Bytes
/
acheievement.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
[CmdletBinding()]
param (
$text = "Test Accomplishment Goes Here",
$out = "achievement_$((get-date).ToString('yyyyMMddHHmmss')).png",
$font = 14
)
Begin{
try{
Add-Type -AssemblyName System.Drawing
$bmp = new-object System.Drawing.Bitmap "$pwd\images\achievement.png"
$headerFont = new-object System.Drawing.Font Consolas,22
$textFont = new-object System.Drawing.Font Consolas,$font
$brushFg = [System.Drawing.Brushes]::White
$graphics = [System.Drawing.Graphics]::FromImage($bmp)
}catch{
write-error "Could Not Initialize Variables"
}
}
Process{
try{
$graphics.DrawString('Achievement Unlocked',$headerFont,$brushFg,65,0)
$graphics.DrawString($text,$textFont,$brushFg,70,45)
}catch{
Write-Error "Could not Add Text to Bitmap"
}
}
End{
try{
$graphics.Dispose()
$bmp.Save("$(pwd)\results\$($out)")
Invoke-Item "$(pwd)\results\$($out)"
}catch{
Write-Error "Could not save Bitmap"
}
}