Help us understand the problem. What is going on with this article?

[powershell]トースト通知を行う。

More than 1 year has passed since last update.

powershellでトースト通知を行う。

15分おきにトースト通知を行って
無為に時間が経過するのを防ぎたかった。

環境

PSVersion 5.1.16299.248
PSEdition Desktop

コード

[Windows.UI.Notifications.ToastNotificationManager, Windows.UI.Notifications, ContentType = WindowsRuntime] | Out-Null
[Windows.UI.Notifications.ToastNotification, Windows.UI.Notifications, ContentType = WindowsRuntime] | Out-Null
[Windows.Data.Xml.Dom.XmlDocument, Windows.Data.Xml.Dom.XmlDocument, ContentType = WindowsRuntime] | Out-Null

$app = '{1AC14E77-02E7-4E5D-B744-2EB1AE5198B7}\WindowsPowerShell\v1.0\powershell.exe'

$template = @"
<toast duration="long">
    <visual>
        <binding template="ToastText02">
            <text id="1">test Title</text>
            <text id="2">test content</text>
        </binding>
    </visual>
  <actions>
  <input id="snoozeTime" type="selection" defaultInput="15">
    #5つまで
    <selection id="3" content="3 minutes" />
    <selection id="5" content="5 minutes" />
    <selection id="10" content="10 minutes" />
    <selection id="15" content="15 minutes" />
    <selection id="30" content="30 minutes" />
  </input>
  <action activationType="system" arguments="snooze" hint-inputId="snoozeTime" content=""/>
  <action activationType="system" arguments="dismiss" content=""/>
  </actions>
</toast>
"@

$xml = New-Object Windows.Data.Xml.Dom.XmlDocument
$xml.LoadXml($template)
$toast = New-Object Windows.UI.Notifications.ToastNotification $xml
[Windows.UI.Notifications.ToastNotificationManager]::CreateToastNotifier($app).Show($toast )

参考URL

https://docs.microsoft.com/en-us/windows/uwp/design/shell/tiles-and-notifications/toast-xml-schema
https://steemit.com/powershell/@esoso/fun-with-toast-notifications-in-powershell
https://qiita.com/akiqsinco/items/0c0d5ae4abc756a594b3

kiduki
rust(fedora)とpowreshell(windows)とに興味あり。
Why not register and get more from Qiita?
  1. We will deliver articles that match you
    By following users and tags, you can catch up information on technical fields that you are interested in as a whole
  2. you can read useful information later efficiently
    By "stocking" the articles you like, you can search right away
Comments
No comments
Sign up for free and join this conversation.
If you already have a Qiita account
Why do not you register as a user and use Qiita more conveniently?
You need to log in to use this function. Qiita can be used more conveniently after logging in.
You seem to be reading articles frequently this month. Qiita can be used more conveniently after logging in.
  1. We will deliver articles that match you
    By following users and tags, you can catch up information on technical fields that you are interested in as a whole
  2. you can read useful information later efficiently
    By "stocking" the articles you like, you can search right away
ユーザーは見つかりませんでした