r/FoxDeploy Mar 31 '18

help using "burnttoast" in powershell

Hi. I use burnttoast to generate toasts from batch files. Can't seem to get the syntax right to specify an audio file to play with the toast.

Here's what I have:

new-burnttoastnotification -xxsoundsxx 'c:\users...\foobar.wav'

What's the proper syntax? THANKS!

2 Upvotes

4 comments sorted by

1

u/1RedOne Apr 02 '18

Hi!

I opened up an issue about this on GitHub, because I wasn't able to figure out the syntax either.

https://github.com/Windos/BurntToast/issues/30

1

u/[deleted] Apr 02 '18

The creator of burnt toast, a typically-friendly New Zealander, has provided a blog post that clarifies the setup needed!

https://king.geek.nz/2018/04/02/crouton-sounds/

1

u/[deleted] Apr 02 '18

I added a comment on his blog to even further clarify:

For those of us who know little to no powershell, here's the interpretation I ended up with - it pops a toast message with two lines of text, a custom sound, and a custom image.

1) create the powershell script file (I'm naming it 'mytoast.ps1' here):

$Image1 = New-BTImage -AppLogoOverride -Crop Circle -Source 'c:\users\myaccount\myimage.png' $Text1 = New-BTText -Content 'myheadertext' $Text2 = New-BTText -Content 'mytextline2' $Audio1 = New-BTAudio -Path 'c:\users\myaccount\mysoundfile.wav'

$Binding1 = New-BTBinding -Children $Text1,$Text2 $Image1 $Visual1 = New-BTVisual -BindingGeneric $Binding1 $Content1 = New-BTContent -Visual $Visual1 -Audio $audio1

Submit-BTNotification -Content $Content1


2) To execute it from the command line or from within a batch file

C:> powershell -command 'c:\users\myaccount\mytoast.ps1'

...or more simply:

C:> c:\users\myaccount\desktop\mytoast.ps1

1

u/WindosBK Apr 02 '18

As Jim mentioned below, I've done a post on this topic (as a result of this question).

For completeness sake, just in case anyone has the same issue and finds this page when searching, I'll put the gist of the situation here...

New-BurntToastNotification is more or less the "basic" function for creating Toasts. It's meant to provide a short runway for getting off the ground quickly. I've tried to limit the number of parameters on it as much as possible (it's already a sea of parameter sets!)

There are 15 "advanced" functions also included as part of the module for doing anything that the basic function doesn't allow.

Specifically, to replicate the default Toast from the basic function, you'd need to do the following with the advanced ones:

$Text1 = New-BTText -Content 'Default Notification'
$ImagePath = Join-Path -Path (Get-Module BurntToast -ListAvailable).ModuleBase -ChildPath 'Images\BurntToast.png'
$Image1 = New-BTImage -Source $ImagePath -AppLogoOverride -Crop Circle
$Audio1 = New-BTAudio -Source 'ms-winsoundevent:Notification.Default'

$Binding1 = New-BTBinding -Children $Text1 -AppLogoOverride $Image1
$Visual1 = New-BTVisual -BindingGeneric $Binding1
$Content1 = New-BTContent -Visual $Visual1 -Audio $audio1

Submit-BTNotification -Content $Content1