2023-03-07 14:28:00 -06:00
|
|
|
Function Get-WinUtilCheckBoxes {
|
|
|
|
|
|
|
|
<#
|
|
|
|
|
2023-10-19 17:12:55 -05:00
|
|
|
.SYNOPSIS
|
|
|
|
Finds all checkboxes that are checked on the specific tab and inputs them into a script.
|
2023-03-07 14:28:00 -06:00
|
|
|
|
2023-10-19 17:12:55 -05:00
|
|
|
.PARAMETER Group
|
|
|
|
The group of checkboxes to check
|
2023-03-07 14:28:00 -06:00
|
|
|
|
2023-10-19 17:12:55 -05:00
|
|
|
.PARAMETER unCheck
|
|
|
|
Whether to uncheck the checkboxes that are checked. Defaults to true
|
2023-03-07 14:28:00 -06:00
|
|
|
|
2023-10-19 17:12:55 -05:00
|
|
|
.OUTPUTS
|
|
|
|
A List containing the name of each checked checkbox
|
|
|
|
|
|
|
|
.EXAMPLE
|
2023-03-07 14:28:00 -06:00
|
|
|
Get-WinUtilCheckBoxes "WPFInstall"
|
|
|
|
|
|
|
|
#>
|
|
|
|
|
|
|
|
Param(
|
|
|
|
$Group,
|
|
|
|
[boolean]$unCheck = $true
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
|
|
$Output = New-Object System.Collections.Generic.List[System.Object]
|
|
|
|
|
|
|
|
if($Group -eq "WPFInstall"){
|
2023-05-09 13:14:27 -05:00
|
|
|
$filter = Get-WinUtilVariables -Type Checkbox | Where-Object {$psitem -like "WPFInstall*"}
|
|
|
|
$CheckBoxes = $sync.GetEnumerator() | Where-Object {$psitem.Key -in $filter}
|
2023-03-07 14:28:00 -06:00
|
|
|
Foreach ($CheckBox in $CheckBoxes){
|
|
|
|
if($CheckBox.value.ischecked -eq $true){
|
2023-05-09 13:14:27 -05:00
|
|
|
$sync.configs.applications.$($CheckBox.Name).winget -split ";" | ForEach-Object {
|
2023-03-07 14:28:00 -06:00
|
|
|
$Output.Add($psitem)
|
|
|
|
}
|
|
|
|
if ($uncheck -eq $true){
|
|
|
|
$CheckBox.value.ischecked = $false
|
|
|
|
}
|
2023-10-19 17:12:55 -05:00
|
|
|
|
2023-03-07 14:28:00 -06:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2023-10-19 17:12:55 -05:00
|
|
|
|
2023-03-07 14:28:00 -06:00
|
|
|
if($Group -eq "WPFTweaks"){
|
2023-05-09 13:14:27 -05:00
|
|
|
$filter = Get-WinUtilVariables -Type Checkbox | Where-Object {$psitem -like "WPF*Tweaks*"}
|
|
|
|
$CheckBoxes = $sync.GetEnumerator() | Where-Object {$psitem.Key -in $filter}
|
|
|
|
Foreach ($CheckBox in $CheckBoxes){
|
|
|
|
if($CheckBox.value.ischecked -eq $true){
|
|
|
|
$Output.Add($Checkbox.Name)
|
2023-10-19 17:12:55 -05:00
|
|
|
|
2023-05-09 13:14:27 -05:00
|
|
|
if ($uncheck -eq $true){
|
|
|
|
$CheckBox.value.ischecked = $false
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
if($Group -eq "WPFFeature"){
|
|
|
|
$filter = Get-WinUtilVariables -Type Checkbox | Where-Object {$psitem -like "WPF*Feature*"}
|
|
|
|
$CheckBoxes = $sync.GetEnumerator() | Where-Object {$psitem.Key -in $filter}
|
2023-03-07 14:28:00 -06:00
|
|
|
Foreach ($CheckBox in $CheckBoxes){
|
|
|
|
if($CheckBox.value.ischecked -eq $true){
|
|
|
|
$Output.Add($Checkbox.Name)
|
2023-10-19 17:12:55 -05:00
|
|
|
|
2023-03-07 14:28:00 -06:00
|
|
|
if ($uncheck -eq $true){
|
|
|
|
$CheckBox.value.ischecked = $false
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
Write-Output $($Output | Select-Object -Unique)
|
|
|
|
}
|