2023-05-09 13:14:27 -05:00
|
|
|
function Get-WinUtilVariables {
|
|
|
|
|
|
|
|
<#
|
2023-10-04 10:22:21 -05:00
|
|
|
|
2023-10-19 17:12:55 -05:00
|
|
|
.SYNOPSIS
|
|
|
|
Gets every form object of the provided type
|
|
|
|
|
|
|
|
.OUTPUTS
|
|
|
|
List containing every object that matches the provided type
|
2023-10-04 10:22:21 -05:00
|
|
|
|
2023-05-09 13:14:27 -05:00
|
|
|
#>
|
|
|
|
param (
|
|
|
|
[Parameter()]
|
2023-10-04 10:22:21 -05:00
|
|
|
[ValidateSet("CheckBox", "Button")]
|
|
|
|
[string]$Type
|
2023-05-09 13:14:27 -05:00
|
|
|
)
|
|
|
|
|
2023-10-04 10:22:21 -05:00
|
|
|
$keys = $sync.keys | Where-Object {$psitem -like "WPF*"}
|
2023-05-09 13:14:27 -05:00
|
|
|
|
2023-10-04 10:22:21 -05:00
|
|
|
if($type){
|
2023-05-09 13:14:27 -05:00
|
|
|
$output = $keys | ForEach-Object {
|
2023-10-04 10:22:21 -05:00
|
|
|
Try{
|
|
|
|
if ($sync["$psitem"].GetType() -like "*$type*"){
|
2023-05-09 13:14:27 -05:00
|
|
|
Write-Output $psitem
|
|
|
|
}
|
|
|
|
}
|
2023-10-04 10:22:21 -05:00
|
|
|
Catch{<#I am here so errors don't get outputted for a couple variables that don't have the .GetType() attribute#>}
|
2023-05-09 13:14:27 -05:00
|
|
|
}
|
2023-10-04 10:22:21 -05:00
|
|
|
return $output
|
2023-05-09 13:14:27 -05:00
|
|
|
}
|
|
|
|
return $keys
|
|
|
|
}
|