Comments (7)
Hey @jeremytbrun! Good question, I don't think I I'd documented this anywhere (and it'd slipped my mind to look into again.)
Behind the scenes there are two options, replace and update.
Replace is what's currently being used, and as you've seen it redraws and displays the toast everyone.
Update would be the smoother experience, as it doesn't redraw (eg if the toast is in the action center it'll be quietly updated with the new info without retoasting the user)
Unfortunately update wasn't working back when this was released. My hope is when I finally get the next release of this out there it'll be working...
I personally want to be providing more frequent update toasts, so I have up to date info if I happen to check the action center. And maybe do a replace toast at 50% and 100%.
from burnttoast.
The New-BTProgressBar
function is creating an object which you can later use as an input to a Toast notification. It looks like what you're seeing there is the "ToString" output of those objects.
It looks like what you may be looking for is the built in Write-Progress
?
Otherwise, best thing to do is pop that BTProgressBar into a variable, then fire off a new Toast notification:
for ([double]$x = 0; $x -lt 100; $x++) {
write-debug "Loop: $x"
$Prog = New-BTProgressBar -Status 'Running' -Value ([double]$x/100) -ValueDisplay ("$x of $TotalToProcess done") -Title "Test Title" -Verbose
New-BurntToastNotification -ProgressBar $Prog -UniqueIdentifier 'TestLoop' -Text 'Test loop'
Start-Sleep -Seconds 1
}
Of note here, the UniqueIdentifier tells Windows to replace the previous Toast(s) with that string attached (i.e. so that you can update the progress on the bar). I've also got a sleep in there, as if they all end up coming through at what is effectively the same moment in time, Windows will just hide them away in the Action Center.
If you run that you'll very quickly notice that you probably shouldn't show a new toast for every single percentage increase... as it triggers a full on toast every single time (complete with animation and sound.)
Hope all of that made sense; no morning coffee yet.
from burnttoast.
from burnttoast.
Ahh, my apologies. I put the "full" example for them in an help for New-BurntToastNotification
... definitely need to change that.
Thanks for opening an issue, btw, it really helps me get a glimpse of what people are using this for and changes/tweaks that need to be made.
from burnttoast.
I'm likely restating some of the obvious, but when running the code snippet provided in this thread it does pop an entirely new toast notification every time. It updates the progress bar, but it makes the notification pop in and out every time the progress bar is updated since it is redrawing the whole thing as a brand new notification. Any way to make it be a smoother experience where the notification stays present and active and only the progress bar changes?
from burnttoast.
Just about to click go on v0.7.0.
Updatable toasts are in, expect a blog post over on https://toastit.dev in the next day or so.
Help still needs work, and that will be the focus of v0.7.1
from burnttoast.
@Windos That blog post doesn't cover how to update the progressbar. How do you do an update with the progressbar?
from burnttoast.
Related Issues (20)
- Toast History access and Toast removal failures on PowerShell 7.1 HOT 3
- No alert sound on multiple machines, except on the first I installed to. HOT 3
- BurntToast -AppLogo does not accept valid UNC paths to WSL locations HOT 2
- Missing documentation on the ActivatedAction parameter on Submit-BTNotification function HOT 1
- empty AppLogo as default value HOT 6
- Doc: how to enable notifications HOT 2
- Typo in Example05? HOT 1
- Toast History access failure on PowerShell 7.2.1 HOT 2
- Provide a feature to read the content of currently displayed Toast Notifications HOT 4
- [Bug]: MethodInvocationException: Exception calling "Show" with "1" argument(s): "Access is denied. HOT 1
- [Bug]: Update-BTNotification not doing its job even when verbose shows no error. HOT 5
- Replace/Remove Shipped DLLs
- Allow variable names to be displayed in the toast notification HOT 1
- character limit notification text HOT 1
- New-BurntToastNotification Button Overflow Menu HOT 1
- icon and heroImage with http-URL HOT 1
- [Bug]: Basic test script does not work HOT 5
- [Bug]: Can't set button label with New-BTButton with Update-BTNotification HOT 2
- warn not to use Windows Store PowerShell
- Easy way to register Notification App (Name and Icon)
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from burnttoast.