如何解决Powershell:如果用户在Toast-Message中按下按钮,则继续脚本
如果用户通过Toast-Message中的“是”按钮确认(我在此项目中不选择使用Windows.Forms),则我正在寻找继续Powershell脚本的选项。 我该怎么办?
这是我到目前为止的示例代码:
$null = [Windows.UI.Notifications.ToastNotificationManager,Windows.UI.Notifications,ContentType = WindowsRuntime]
$null = [Windows.Data.Xml.Dom.XmlDocument,Windows.Data.Xml.Dom.XmlDocument,ContentType = WindowsRuntime]
$XmlString = @"
<toast launch = "Test1" scenario='alarm'>
<visual>
<binding template="ToastGeneric">
<text>Title</text>
<text>Message</text>
</binding>
</visual>
<audio src="ms-winsoundevent:Notification.Looping.Alarm" />
<actions>
<action content="yes" arguments="yes" activationType="foreground" />
<action content="no" arguments="no" activationType="foreground" />
</actions>
</toast>
"@
$AppId = '{1AC14E77-02E7-4E5D-B744-2EB1AE5198B7}\WindowsPowerShell\v1.0\powershell.exe'
$ToastXml = [Windows.Data.Xml.Dom.XmlDocument]::new()
$ToastXml.LoadXml($XmlString)
$Toast = [Windows.UI.Notifications.ToastNotification]::new($ToastXml)
$null = [Windows.UI.Notifications.ToastNotificationManager]::CreateToastNotifier($AppId).Show($Toast)
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。