-
-
Notifications
You must be signed in to change notification settings - Fork 5
Expand file tree
/
Copy path04_DIY_XML.ps1
More file actions
41 lines (35 loc) · 1.77 KB
/
04_DIY_XML.ps1
File metadata and controls
41 lines (35 loc) · 1.77 KB
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
$Content1.GetContent()
# <?xml version="1.0" encoding="utf-8"?>
# <toast scenario="incomingCall">
# <visual>
# <binding template="ToastGeneric">
# <text>{No... Like FOREVER!}</text>
# <text>{When you absolutley have to get a message across, play up the "scenario".}</text>
# <image src="C:\Users\JoshKing\AppData\Local\Temp\https---i.imgur.com-ZbdyG6F.gif" placement="appLogoOverride" />
# </binding>
# </visual>
# <audio src="ms-winsoundevent:Notification.Looping.Call10" loop="true" />
# </toast>
$CleanContent = $Content1.GetContent() -Replace '<text(.*?)>{', '<text$1>'
$CleanContent = $CleanContent.Replace('}</text>', '</text>')
$CleanContent = $CleanContent.Replace('="{', '="')
$CleanContent = $CleanContent.Replace('}" ', '" ')
$CleanContent
# <?xml version="1.0" encoding="utf-8"?>
# <toast scenario="incomingCall">
# <visual>
# <binding template="ToastGeneric">
# <text>No... Like FOREVER!</text>
# <text>When you absolutley have to get a message across, play up the "scenario".</text>
# <image src="C:\Users\JoshKing\AppData\Local\Temp\https---i.imgur.com-ZbdyG6F.gif" placement="appLogoOverride" />
# </binding>
# </visual>
# <audio src="ms-winsoundevent:Notification.Looping.Call10" loop="true" />
# </toast>
$AppId = '{1AC14E77-02E7-4E5D-B744-2EB1AE5198B7}\WindowsPowerShell\v1.0\powershell.exe'
$ToastXml = [Windows.Data.Xml.Dom.XmlDocument]::new()
$ToastXml.LoadXml($Content1.GetContent())
$Toast = [Windows.UI.Notifications.ToastNotification]::new($ToastXml)
[Windows.UI.Notifications.ToastNotificationManager]::CreateToastNotifier($AppId).Show($Toast)
# NOTE: This only works in PowerShell 7.1 with BurntToast imported, prior version need to load some WinRT stuff manually.
# Details: https://toast.click/NoBurntToast