I've just been testing my scripts against version 0.5.0. All was fine until I tested the one script I have which uses New-Object rather than Show-AnyBox followed by parameters. This script works fine with version 0.4.0 but with version 0.5.0 the Messages and Comments are missing.
I've enclosed a simplified version of the AnyBox code below:
Import-Module AnyBox$AnyBox = New-Object AnyBox.AnyBox$DevicesList = @('PC-ELAINE','PC-IAN','PC-RICHARD','PC-SAMANTHA')
$AnyBox.Prompts = @( New-AnyBoxPrompt -InputType Text -Message "What's the name of the target computer?" -ValidateSet $DevicesList -ShowSetAs Radio -ValidateScript { $_ -Ne '' } )
$AnyBox.Buttons = 'Continue','Cancel'$AnyBox.CancelButton = 'Cancel'$AnyBox.DefaultButton = 'Continue'$AnyBox.Comment = "","Comment line.",""$AnyBox.Message = "Message line 1.","Message line 2."$AnyBoxResult = $AnyBox | Show-AnyBox
With version 0.4.0 the following window is displayed:
However, with exactly the same code in version 0.5.0 I get:
If I change the code as follows:
$DevicesList = @('PC-ELAINE','PC-IAN','PC-RICHARD','PC-SAMANTHA')
$Prompt = @( New-AnyBoxPrompt -InputType Text -Message "What's the name of the target computer?" -ValidateSet $DevicesList -ShowSetAs Radio -ValidateScript { $_ -Ne '' } )
$AnyBoxResult = Show-AnyBox -Buttons 'Continue','Cancel' -CancelButton 'Cancel' -DefaultButton 'Continue' -Comments "","Comment line.","" -Messages "Message line 1.","Message line 2." -Prompts $Prompt
I get the following window with version 0.5.0 (i.e. the same as the New-Object method with version 0.4.0):
Obviously this isn't a big deal since I can rewrite the code. However, there are times where the New-Object method is preferable - i.e. if you want different messages or comments depending on some variable.
Let me know if anything is unclear or you need more information.
I've just been testing my scripts against version 0.5.0. All was fine until I tested the one script I have which uses New-Object rather than Show-AnyBox followed by parameters. This script works fine with version 0.4.0 but with version 0.5.0 the Messages and Comments are missing.
I've enclosed a simplified version of the AnyBox code below:
Import-Module AnyBox
$AnyBox = New-Object AnyBox.AnyBox
$DevicesList = @('PC-ELAINE','PC-IAN','PC-RICHARD','PC-SAMANTHA')
$AnyBox.Prompts = @( New-AnyBoxPrompt -InputType Text -Message "What's the name of the target computer?" -ValidateSet $DevicesList -ShowSetAs Radio -ValidateScript { $_ -Ne '' } )
$AnyBox.Buttons = 'Continue','Cancel'
$AnyBox.CancelButton = 'Cancel'
$AnyBox.DefaultButton = 'Continue'
$AnyBox.Comment = "","Comment line.",""
$AnyBox.Message = "Message line 1.","Message line 2."
$AnyBoxResult = $AnyBox | Show-AnyBox
With version 0.4.0 the following window is displayed:
However, with exactly the same code in version 0.5.0 I get:
If I change the code as follows:
$DevicesList = @('PC-ELAINE','PC-IAN','PC-RICHARD','PC-SAMANTHA')
$Prompt = @( New-AnyBoxPrompt -InputType Text -Message "What's the name of the target computer?" -ValidateSet $DevicesList -ShowSetAs Radio -ValidateScript { $_ -Ne '' } )
$AnyBoxResult = Show-AnyBox -Buttons 'Continue','Cancel' -CancelButton 'Cancel' -DefaultButton 'Continue' -Comments "","Comment line.","" -Messages "Message line 1.","Message line 2." -Prompts $Prompt
I get the following window with version 0.5.0 (i.e. the same as the New-Object method with version 0.4.0):
Obviously this isn't a big deal since I can rewrite the code. However, there are times where the New-Object method is preferable - i.e. if you want different messages or comments depending on some variable.
Let me know if anything is unclear or you need more information.
Many thanks Ian