Enabled a second action button
This commit is contained in:
parent
014e69d8a8
commit
268bdc53ba
2 changed files with 53 additions and 6 deletions
|
|
@ -1343,6 +1343,7 @@ if(-NOT[string]::IsNullOrEmpty($Xml)) {
|
||||||
}
|
}
|
||||||
$Scenario = $Xml.Configuration.Option | Where-Object {$_.Name -like 'Scenario'} | Select-Object -ExpandProperty 'Type'
|
$Scenario = $Xml.Configuration.Option | Where-Object {$_.Name -like 'Scenario'} | Select-Object -ExpandProperty 'Type'
|
||||||
$Action = $Xml.Configuration.Option | Where-Object {$_.Name -like 'Action'} | Select-Object -ExpandProperty 'Value'
|
$Action = $Xml.Configuration.Option | Where-Object {$_.Name -like 'Action'} | Select-Object -ExpandProperty 'Value'
|
||||||
|
$Action2 = $Xml.Configuration.Option | Where-Object {$_.Name -like 'Action2'} | Select-Object -ExpandProperty 'Value'
|
||||||
$GreetGivenName = $Xml.Configuration.Text | Where-Object {$_.Option -like 'GreetGivenName'} | Select-Object -ExpandProperty 'Enabled'
|
$GreetGivenName = $Xml.Configuration.Text | Where-Object {$_.Option -like 'GreetGivenName'} | Select-Object -ExpandProperty 'Enabled'
|
||||||
$MultiLanguageSupport = $Xml.Configuration.Text | Where-Object {$_.Option -like 'MultiLanguageSupport'} | Select-Object -ExpandProperty 'Enabled'
|
$MultiLanguageSupport = $Xml.Configuration.Text | Where-Object {$_.Option -like 'MultiLanguageSupport'} | Select-Object -ExpandProperty 'Enabled'
|
||||||
# Load Custom Action Details
|
# Load Custom Action Details
|
||||||
|
|
@ -1351,6 +1352,7 @@ if(-NOT[string]::IsNullOrEmpty($Xml)) {
|
||||||
$CustomActionName = $Xml.Configuration.CustomActions.Action.Name
|
$CustomActionName = $Xml.Configuration.CustomActions.Action.Name
|
||||||
# Load Toast Notification buttons
|
# Load Toast Notification buttons
|
||||||
$ActionButtonEnabled = $Xml.Configuration.Option | Where-Object {$_.Name -like 'ActionButton'} | Select-Object -ExpandProperty 'Enabled'
|
$ActionButtonEnabled = $Xml.Configuration.Option | Where-Object {$_.Name -like 'ActionButton'} | Select-Object -ExpandProperty 'Enabled'
|
||||||
|
$Action2ButtonEnabled = $Xml.Configuration.Option | Where-Object {$_.Name -like 'Action2Button'} | Select-Object -ExpandProperty 'Enabled'
|
||||||
$DismissButtonEnabled = $Xml.Configuration.Option | Where-Object {$_.Name -like 'DismissButton'} | Select-Object -ExpandProperty 'Enabled'
|
$DismissButtonEnabled = $Xml.Configuration.Option | Where-Object {$_.Name -like 'DismissButton'} | Select-Object -ExpandProperty 'Enabled'
|
||||||
$SnoozeButtonEnabled = $Xml.Configuration.Option | Where-Object {$_.Name -like 'SnoozeButton'} | Select-Object -ExpandProperty 'Enabled'
|
$SnoozeButtonEnabled = $Xml.Configuration.Option | Where-Object {$_.Name -like 'SnoozeButton'} | Select-Object -ExpandProperty 'Enabled'
|
||||||
# Multi language support
|
# Multi language support
|
||||||
|
|
@ -1381,6 +1383,7 @@ if(-NOT[string]::IsNullOrEmpty($Xml)) {
|
||||||
$ADPasswordExpirationTextValue = $XmlLang.Text | Where-Object {$_.Name -like 'ADPasswordExpirationText'} | Select-Object -ExpandProperty '#text'
|
$ADPasswordExpirationTextValue = $XmlLang.Text | Where-Object {$_.Name -like 'ADPasswordExpirationText'} | Select-Object -ExpandProperty '#text'
|
||||||
$CustomAudioTextToSpeech = $XmlLang.Text | Where-Object {$_.Name -like 'CustomAudio'} | Select-Object -ExpandProperty '#text'
|
$CustomAudioTextToSpeech = $XmlLang.Text | Where-Object {$_.Name -like 'CustomAudio'} | Select-Object -ExpandProperty '#text'
|
||||||
$ActionButtonContent = $XmlLang.Text | Where-Object {$_.Name -like 'ActionButton'} | Select-Object -ExpandProperty '#text'
|
$ActionButtonContent = $XmlLang.Text | Where-Object {$_.Name -like 'ActionButton'} | Select-Object -ExpandProperty '#text'
|
||||||
|
$Action2ButtonContent = $XmlLang.Text | Where-Object {$_.Name -like 'Action2Button'} | Select-Object -ExpandProperty '#text'
|
||||||
$DismissButtonContent = $XmlLang.Text | Where-Object {$_.Name -like 'DismissButton'} | Select-Object -ExpandProperty '#text'
|
$DismissButtonContent = $XmlLang.Text | Where-Object {$_.Name -like 'DismissButton'} | Select-Object -ExpandProperty '#text'
|
||||||
$SnoozeButtonContent = $XmlLang.Text | Where-Object {$_.Name -like 'SnoozeButton'} | Select-Object -ExpandProperty '#text'
|
$SnoozeButtonContent = $XmlLang.Text | Where-Object {$_.Name -like 'SnoozeButton'} | Select-Object -ExpandProperty '#text'
|
||||||
$AttributionText = $XmlLang.Text | Where-Object {$_.Name -like 'AttributionText'} | Select-Object -ExpandProperty '#text'
|
$AttributionText = $XmlLang.Text | Where-Object {$_.Name -like 'AttributionText'} | Select-Object -ExpandProperty '#text'
|
||||||
|
|
@ -1585,6 +1588,12 @@ if (($CustomActionsEnabled -eq "True") -AND (($UpgradeOS -eq "True") -or ($Pendi
|
||||||
Write-Log -Level Error -Message "You should only enable one of the features or CustomActions"
|
Write-Log -Level Error -Message "You should only enable one of the features or CustomActions"
|
||||||
Exit 1
|
Exit 1
|
||||||
}
|
}
|
||||||
|
if (($ActionButtonEnabled -ne "True") -AND ($Action2ButtonEnabled -eq "True")){
|
||||||
|
Write-Log -Level Error -Message "Error. Conflicting selection in the $Config file"
|
||||||
|
Write-Log -Level Error -Message "Error. You can't have Action2Button enabled and ActionButton not enabled."
|
||||||
|
Write-Log -Level Error -Message "ActionButton must be enabled for Action2Button to be enabled. Check your config"
|
||||||
|
Exit 1
|
||||||
|
}
|
||||||
|
|
||||||
# Downloading images into user's temp folder if images are hosted online
|
# Downloading images into user's temp folder if images are hosted online
|
||||||
if (($LogoImageFileName.StartsWith("https://")) -OR ($LogoImageFileName.StartsWith("http://"))) {
|
if (($LogoImageFileName.StartsWith("https://")) -OR ($LogoImageFileName.StartsWith("http://"))) {
|
||||||
|
|
@ -1800,7 +1809,7 @@ if ($GreetGivenName -eq "True") {
|
||||||
|
|
||||||
# Formatting the toast notification XML
|
# Formatting the toast notification XML
|
||||||
# Create the default toast notification XML with action button and dismiss button
|
# Create the default toast notification XML with action button and dismiss button
|
||||||
if (($ActionButtonEnabled -eq "True") -AND ($DismissButtonEnabled -eq "True")) {
|
if (($ActionButtonEnabled -eq "True") -AND ($Action2ButtonEnabled -ne "True") -AND ($DismissButtonEnabled -eq "True")) {
|
||||||
Write-Log -Message "Creating the xml for displaying both action button and dismiss button"
|
Write-Log -Message "Creating the xml for displaying both action button and dismiss button"
|
||||||
[xml]$Toast = @"
|
[xml]$Toast = @"
|
||||||
<toast scenario="$Scenario">
|
<toast scenario="$Scenario">
|
||||||
|
|
@ -1835,8 +1844,45 @@ if (($ActionButtonEnabled -eq "True") -AND ($DismissButtonEnabled -eq "True")) {
|
||||||
"@
|
"@
|
||||||
}
|
}
|
||||||
|
|
||||||
|
# Create the default toast notification XML with action button and dismiss button
|
||||||
|
if (($Action2ButtonEnabled -eq "True") -AND ($ActionButtonEnabled -eq "True") -AND ($DismissButtonEnabled -eq "True")) {
|
||||||
|
Write-Log -Message "Creating the xml for displaying both action button and dismiss button"
|
||||||
|
[xml]$Toast = @"
|
||||||
|
<toast scenario="$Scenario">
|
||||||
|
<visual>
|
||||||
|
<binding template="ToastGeneric">
|
||||||
|
<image placement="hero" src="$HeroImage"/>
|
||||||
|
<image id="1" placement="appLogoOverride" hint-crop="circle" src="$LogoImage"/>
|
||||||
|
<text placement="attribution">$AttributionText</text>
|
||||||
|
<text>$HeaderText</text>
|
||||||
|
<group>
|
||||||
|
<subgroup>
|
||||||
|
<text hint-style="title" hint-wrap="true" >$TitleText</text>
|
||||||
|
</subgroup>
|
||||||
|
</group>
|
||||||
|
<group>
|
||||||
|
<subgroup>
|
||||||
|
<text hint-style="body" hint-wrap="true" >$BodyText1</text>
|
||||||
|
</subgroup>
|
||||||
|
</group>
|
||||||
|
<group>
|
||||||
|
<subgroup>
|
||||||
|
<text hint-style="body" hint-wrap="true" >$BodyText2</text>
|
||||||
|
</subgroup>
|
||||||
|
</group>
|
||||||
|
</binding>
|
||||||
|
</visual>
|
||||||
|
<actions>
|
||||||
|
<action activationType="protocol" arguments="$Action" content="$ActionButtonContent" />
|
||||||
|
<action activationType="protocol" arguments="$Action2" content="$Action2ButtonContent" />
|
||||||
|
<action activationType="system" arguments="dismiss" content="$DismissButtonContent"/>
|
||||||
|
</actions>
|
||||||
|
</toast>
|
||||||
|
"@
|
||||||
|
}
|
||||||
|
|
||||||
# NO action button and NO dismiss button
|
# NO action button and NO dismiss button
|
||||||
if (($ActionButtonEnabled -ne "True") -AND ($DismissButtonEnabled -ne "True")) {
|
if (($ActionButtonEnabled -ne "True") -AND ($Action2ButtonEnabled -ne "True") -AND ($DismissButtonEnabled -ne "True")) {
|
||||||
Write-Log -Message "Creating the xml for no action button and no dismiss button"
|
Write-Log -Message "Creating the xml for no action button and no dismiss button"
|
||||||
[xml]$Toast = @"
|
[xml]$Toast = @"
|
||||||
<toast scenario="$Scenario">
|
<toast scenario="$Scenario">
|
||||||
|
|
@ -1870,7 +1916,7 @@ if (($ActionButtonEnabled -ne "True") -AND ($DismissButtonEnabled -ne "True")) {
|
||||||
}
|
}
|
||||||
|
|
||||||
# Action button and NO dismiss button
|
# Action button and NO dismiss button
|
||||||
if (($ActionButtonEnabled -eq "True") -AND ($DismissButtonEnabled -ne "True")) {
|
if (($ActionButtonEnabled -eq "True") -AND ($Action2ButtonEnabled -ne "True") -AND ($DismissButtonEnabled -ne "True")) {
|
||||||
Write-Log -Message "Creating the xml for no dismiss button"
|
Write-Log -Message "Creating the xml for no dismiss button"
|
||||||
[xml]$Toast = @"
|
[xml]$Toast = @"
|
||||||
<toast scenario="$Scenario">
|
<toast scenario="$Scenario">
|
||||||
|
|
@ -1905,7 +1951,7 @@ if (($ActionButtonEnabled -eq "True") -AND ($DismissButtonEnabled -ne "True")) {
|
||||||
}
|
}
|
||||||
|
|
||||||
# Dismiss button and NO action button
|
# Dismiss button and NO action button
|
||||||
if (($ActionButtonEnabled -ne "True") -AND ($DismissButtonEnabled -eq "True")) {
|
if (($ActionButtonEnabled -ne "True") -AND ($Action2ButtonEnabled -ne "True") -AND ($DismissButtonEnabled -eq "True")) {
|
||||||
Write-Log -Message "Creating the xml for no action button"
|
Write-Log -Message "Creating the xml for no action button"
|
||||||
[xml]$Toast = @"
|
[xml]$Toast = @"
|
||||||
<toast scenario="$Scenario">
|
<toast scenario="$Scenario">
|
||||||
|
|
|
||||||
|
|
@ -24,12 +24,12 @@
|
||||||
<Option Name="LogoImageName" Value="ToastLogoImageDefault.jpg" /> <!-- File name of the image shown as logo in the toast notoification -->
|
<Option Name="LogoImageName" Value="ToastLogoImageDefault.jpg" /> <!-- File name of the image shown as logo in the toast notoification -->
|
||||||
<Option Name="HeroImageName" Value="ToastHeroImageDefault.jpg" /> <!-- File name of the image shown in the top of the toast notification -->
|
<Option Name="HeroImageName" Value="ToastHeroImageDefault.jpg" /> <!-- File name of the image shown in the top of the toast notification -->
|
||||||
<Option Name="ActionButton" Enabled="True" /> <!-- Enables or disables the action button. -->
|
<Option Name="ActionButton" Enabled="True" /> <!-- Enables or disables the action button. -->
|
||||||
<Option Name="ActionButton2" Enabled="False" /> <!-- Enables or disables the action button. -->
|
<Option Name="Action2Button" Enabled="True" /> <!-- Enables or disables the action button. -->
|
||||||
<Option Name="DismissButton" Enabled="True" /> <!-- Enables or disables the dismiss button. -->
|
<Option Name="DismissButton" Enabled="True" /> <!-- Enables or disables the dismiss button. -->
|
||||||
<Option Name="SnoozeButton" Enabled="False" /> <!-- Enabling this option will always enable action button and dismiss button -->
|
<Option Name="SnoozeButton" Enabled="False" /> <!-- Enabling this option will always enable action button and dismiss button -->
|
||||||
<Option Name="Scenario" Type="reminder" /> <!-- Possible values are: reminder | short | long -->
|
<Option Name="Scenario" Type="reminder" /> <!-- Possible values are: reminder | short | long -->
|
||||||
<Option Name="Action" Value="LaunchAppRepair:" /> <!-- Action taken when using the Action button. Can be any protocol in Windows -->
|
<Option Name="Action" Value="LaunchAppRepair:" /> <!-- Action taken when using the Action button. Can be any protocol in Windows -->
|
||||||
<Option Name="Action2" Value="ToastReboot:" /> <!-- Action taken when using the Action button. Can be any protocol in Windows -->
|
<Option Name="Action2" Value="https://wetterssource.com" /> <!-- Action taken when using the Action button. Can be any protocol in Windows -->
|
||||||
<CustomActions Enabled="true">
|
<CustomActions Enabled="true">
|
||||||
<DetectionScript>
|
<DetectionScript>
|
||||||
$PathExists = Test-Path 'C:\Windows\System32' -ErrorAction Ignore
|
$PathExists = Test-Path 'C:\Windows\System32' -ErrorAction Ignore
|
||||||
|
|
@ -88,6 +88,7 @@ $ToastXml.LoadXml($Toast.OuterXml)
|
||||||
<Text Name="ADPasswordExpirationText">Your password will expire on: </Text> <!-- Text used if the ADPasswordExpirationText Option is enabled -->
|
<Text Name="ADPasswordExpirationText">Your password will expire on: </Text> <!-- Text used if the ADPasswordExpirationText Option is enabled -->
|
||||||
<Text Name="CustomAudioTextToSpeech">Hey you - wake up. Your computer needs to restart. Do it now.</Text> <!-- Text to speech used if the CustomAudioTextToSpeech Option is enabled -->
|
<Text Name="CustomAudioTextToSpeech">Hey you - wake up. Your computer needs to restart. Do it now.</Text> <!-- Text to speech used if the CustomAudioTextToSpeech Option is enabled -->
|
||||||
<Text Name="ActionButton">Do it!</Text> <!-- Text on the ActionButton if enabled -->
|
<Text Name="ActionButton">Do it!</Text> <!-- Text on the ActionButton if enabled -->
|
||||||
|
<Text Name="Action2Button">Do More</Text> <!-- Text on the ActionButton if enabled -->
|
||||||
<Text Name="DismissButton">Later</Text> <!-- Text on the DismissButton if enabled -->
|
<Text Name="DismissButton">Later</Text> <!-- Text on the DismissButton if enabled -->
|
||||||
<Text Name="SnoozeButton">Snooze</Text> <!-- Text on the SnoozeButton if enabled -->
|
<Text Name="SnoozeButton">Snooze</Text> <!-- Text on the SnoozeButton if enabled -->
|
||||||
<Text Name="AttributionText">www.imab.dk</Text>
|
<Text Name="AttributionText">www.imab.dk</Text>
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue