Click here to Skip to main content
15,884,298 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I use BurntToast module in order to throw toast notifications in Windows 11.

Here is my notification:

https://i.stack.imgur.com/wWOV1.png

When I click Pause button, its caption should be changed to Resume and its argument should be changed to stackoverflow://resume.

Here is the screenshot which describes what I want:

https://i.stack.imgur.com/yQfeF.png

PS: This notification is not updated from first one. I have created fresh notification in order to show.

So, how can I achieve that?

What I have tried:

Here are my codes:

PowerShell
$Data =
@{
    Line1Data = 'Line 1'
    Line2Data = 'Line 2'
    Line3Data = 'Line 3'
    StatusData = ''
    TitleData = 'The file is being downloaded...'
    ValueData = 15/100
}

$Button1 = New-BTButton -Arguments 'stackoverflow://pause' -Content 'Pause' -ActivationType Protocol
$Button2 = New-BTButton -Arguments 'stackoverflow://cancel' -Content 'Cancel' -ActivationType Protocol
$ProgressBar = New-BTProgressBar -Status 'StatusData' -Title 'TitleData' -Value 'ValueData'

New-BurntToastNotification -Button $Button1, $Button2 -ProgressBar $ProgressBar -Text 'Line1Data', 'Line2Data', 'Line3Data' -DataBinding $Data -UniqueIdentifier 'example'
Posted
Updated 19-Feb-23 6:46am

1 solution

The following might help -
$Button1 = Get-ChildItem -Path 'SomePath\SomeFile' | Out-GridView -OutputMode Single -PassThru -Title 'SomeTitle' | ForEach-Object { $_.name }

if ($button -eq 'pause') {
    $button = 'resume'
}

Write-Host "Button text is now $button"
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900