< Back

New-BTButton

Sun Jan 12, 2020 7:31 pm

NAME New-BTButton



SYNOPSIS

Creates a new clickable button for a Toast Notification.





SYNTAX

New-BTButton -Content <String> -Arguments <String> [-ActivationType {Foreground | Background | Protocol}]

[-ImageUri <String>] [-Id <String>] [-WhatIf] [-Confirm] [<CommonParameters>]



New-BTButton -Snooze [-Content <String>] [-Id <String>] [-WhatIf] [-Confirm] [<CommonParameters>]



New-BTButton -Dismiss [-Content <String>] [-WhatIf] [-Confirm] [<CommonParameters>]





DESCRIPTION

The New-BTButton function creates a new clickable button for a Toast Notification. Up to five buttons can be added

to one Toast.



Buttons can be fully customized with display text, images and arguments or system handled 'Snooze' and 'Dismiss'

buttons.





PARAMETERS

-Snooze [<SwitchParameter>]

Specifies a system handled snooze button. When paired with a selection box the snooze time is customizable and

user selectable, otherwise the system default snooze time is used.



Display text defaults to a localized 'Snooze', but this can be overridden with the Content parameter.



Required? true

Position? named

Default value False

Accept pipeline input? false

Accept wildcard characters? false



-Dismiss [<SwitchParameter>]

Specifies a system handled dismiss button. Clicking the resulting button has the same affect as 'swiping away'

or otherwise dismissing the Toast.



Display text defaults to a localized 'Dismiss', but this can be overridden with the Content parameter.



Required? true

Position? named

Default value False

Accept pipeline input? false

Accept wildcard characters? false



-Content <String>

Specifies the text to display on the button.



Required? true

Position? named

Default value

Accept pipeline input? false

Accept wildcard characters? false



-Arguments <String>

Specifies an app defined string.



For the purposes of BurntToast notifications this is generally the path to a file or URI and paired with the

Protocol ActivationType.



Required? true

Position? named

Default value

Accept pipeline input? false

Accept wildcard characters? false



-ActivationType

Defines tne ActivationType that is trigger when the button is pressed.



Defaults to Protocol which will open the file or URI specified in with the Arguments parameter in the rlevant

system default application.



Required? false

Position? named

Default value Protocol

Accept pipeline input? false

Accept wildcard characters? false



-ImageUri <String>

Specifies an image icon to display on the button.



Required? false

Position? named

Default value

Accept pipeline input? false

Accept wildcard characters? false



-Id <String>

Specifies the ID of a relevant Toast control.



Standard buttons can be paried with a text box which makes the button appear to the right of it.



Snooze buttons can be paired with a selection box to select the ammount of time to snooze.



Required? false

Position? named

Default value

Accept pipeline input? false

Accept wildcard characters? false



-WhatIf [<SwitchParameter>]



Required? false

Position? named

Default value

Accept pipeline input? false

Accept wildcard characters? false



-Confirm [<SwitchParameter>]



Required? false

Position? named

Default value

Accept pipeline input? false

Accept wildcard characters? false



<CommonParameters>

This cmdlet supports the common parameters: Verbose, Debug,

ErrorAction, ErrorVariable, WarningAction, WarningVariable,

OutBuffer, PipelineVariable, and OutVariable. For more information, see

about_CommonParameters (https:/go.microsoft.com/fwlink/?LinkID=113216).



INPUTS

None

You cannot pipe input to this function.





OUTPUTS

Microsoft.Toolkit.Uwp.Notifications.ToastButton

Microsoft.Toolkit.Uwp.Notifications.ToastButtonDismiss

Microsoft.Toolkit.Uwp.Notifications.ToastButtonSnooze





-------------------------- EXAMPLE 1 --------------------------



PS C:\\>New-BTButton -Dismiss



This command creates a button which mimmicks the act of 'swiping away' the Toast when clicked.









-------------------------- EXAMPLE 2 --------------------------



PS C:\\>New-BTButton -Snooze



This command creates a button which will snooze the Toast for the system default snooze time (often 10 minutes).









-------------------------- EXAMPLE 3 --------------------------



PS C:\\>New-BTButton -Snooze -Content 'Sleep' -Id 'TimeSelection'



This command creates a button which will snooze the Toast for the time selected in the SelectionBox with the ID

'TimeSelection'. The button will show the text 'Sleep' rather than 'Dismiss.'









-------------------------- EXAMPLE 4 --------------------------



PS C:\\>New-BTButton -Content 'Blog' -Arguments 'https://king.geek.nz'



This command creates a button with the display text "Blog", which will launch a browser window to

"http://king.geek.nz" when clicked.









-------------------------- EXAMPLE 5 --------------------------



PS C:\\>$Picture = 'C:\\temp\\example.png'



New-BTButton -Content 'View Picture' -Arguments $Picture -ImageUri $Picture



This example creates a button with the display text "View Picture" with a picture to the left, which will launch

the default picture viewer application and load the picture when clicked.











RELATED LINKS

https://github.com/Windos/BurntToast/bl ... TButton.md