Giter Club home page Giter Club logo

anybox's Introduction

'Ello World ๐Ÿ‘‹

anybox's People

Contributors

chirishman avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

anybox's Issues

Resize

Even with parameter Norisize -ResizeMode NoResize and =
-NoResize when it exceeds the limit it increases by itself. know how to help me

image

Probable AnyBox resource leak

I use AnyBox to create dialog windows for my PS script. Although a number of different windows might be used, every time the script runs this large dialog is shown.

image

On occasion I get an Unhandled Windows Exception Error like this

Unhandled exception. System.ComponentModel.Win32Exception (1816): Not enough quota is available to process this command.
   at System.Windows.Interop.HwndTarget.UpdateWindowSettings(Boolean enableRenderTarget, Nullable`1 channelSet)
   at System.Windows.Interop.HwndTarget.UpdateWindowPos(IntPtr lParam)
   at System.Windows.Interop.HwndTarget.HandleMessage(WindowMessage msg, IntPtr wparam, IntPtr lparam)
   at System.Windows.Interop.HwndSource.HwndTargetFilterMessage(IntPtr hwnd, Int32 msg, IntPtr wParam, IntPtr lParam, Boolean& handled)
   at System.Windows.Threading.ExceptionWrapper.InternalRealCall(Delegate callback, Object args, Int32 numArgs)
   at System.Windows.Threading.ExceptionWrapper.TryCatchWhen(Object source, Delegate callback, Object args, Int32 numArgs, Delegate catchHandler)
   at System.Windows.Threading.Dispatcher.LegacyInvokeImpl(DispatcherPriority priority, TimeSpan timeout, Delegate method, Object args, Int32 numArgs)
   at MS.Win32.HwndSubclass.SubclassWndProc(IntPtr hwnd, Int32 msg, IntPtr wParam, IntPtr lParam)

ChatGPT analysis seems spot on (a small part of a much longer session).

The full error message you've provided offers more context and helps narrow down the possible causes of the "Not enough quota is available to process this command" error. This error is thrown from within the Windows Presentation Foundation (WPF) infrastructure, as indicated by the stack trace involving classes like HwndTarget, HwndSource, and the WPF Dispatcher. This suggests that the issue is related to the graphical user interface (GUI) components of your application or script, which aligns with the suspicion around AnyBox or any other part of your script that creates or manipulates windows or other GUI elements.

Since the rest of the script deals with handing files to ImageMagick for conversion, the error most likely comes from AnyBox, perhaps by not properly releasing resources?

Include 'please wait' window processing and ability to highlight one part of -Message

I have a couple of graphical user interface scripts which I wrote before I came across AnyBox. Since you've published version 0.5.0 it reminded me that I had planned to rewrite these using AnyBox. I suspect my script of 200+ lines of code will reduce considerably. While I've not looked at this in too much detail, as yet, there is one aspect of my script which I suspect AnyBox doesn't support.

When I run my script a 'please wait' window is displayed while the script does some processing. This processing can take 20 or 30 seconds. Once the processing is complete the 'please wait' window is closed and a new window is displayed with the result of the processing. The user then makes their selection of what they want to do next and processing continues once the window is dismissed.

I don't think there will be too much of a problem using AnyBox to produce the 2nd window. However, I can't see anything within AnyBox which will create and display the 'please wait' window.

  • Have I missed something?
  • If not, would it be possible to enhance AnyBox to incorporate this functionality?

One final thing. The 'please wait' window is just a few lines of text. However, one of the lines of text is highlighted in red to make it stand out. I suspect I would be using the -Messages parameter of AnyBox to create the text but I can't see any way to highlight one line of the -Message.

  • Have I missed something?
  • If not, would it be possible to enhance AnyBox to incorporate this functionality?

Once again, many thanks.
Ian

CheckBox?

I am working on a new user provisioning scripts and I need to select which groups to add the user to. How can that be accomplished? I already have 1 datagrid in the project. I could use that but I do not see how to add two datagrids.

I was thinking of doing something like the radio buttons but with multi-select but I did not see how to do that either.

Thanks

Checkbox checked

I haven't seen how to show checkbox already checked.

Is it possible ?

Great module

First let me say this is the type of module that I have been looking for for a long time. This will make mine and many other script(s) much easier to accept input.

Once I downloaded the module I tried to run the examples on the web page - I ran into a couple errors.

Show-AnyBox -Message 'Provide your name:' -Prompt @{} -Comment 'First name only' -Buttons 'OK'
-- error "Item has already been added. Key in dictionary: 'txt_Explain' Key being added: 'txt_Explain'"
-- removing comment removes error
This also show "First Name "only twice.

Show-AnyBox -Title 'AnyBox Demo' -Message 'Select a number:' -Buttons @(1..9) -ButtonRows 3
--comes back with name value pair 1-9
--The number that is selected is in the list twice - is that desired result
--If so how would you recommend testing to figure out what buttons was pressed?

$prompt = New-AnyBoxPrompt -Message 'Enter any number between 0 and 100:' -ValidateScript { $_ -ge 0 -and $_ -le 100 }
Show-AnyBox -Prompt $prompt -Buttons 'Submit'
--even if I type 9 in I never get out of loop

Show-AnyBox -MinWidth 350 -Buttons 'Cancel', 'Submit' -Prompt @(
(New-AnyBoxPrompt -InputType 'FileOpen' -Message 'Open File:', ReadOnly=$true),
(New-AnyBoxPrompt -InputType 'FileSave' -Message 'Save File:', ReadOnly=$true)
)
--could not get this to work at all

Show-AnyBox -Icon 'Question' -Buttons 'Cancel', 'Ignore' -Message 'An error occurred. (Code=123)'
-Prompt (New-AnyBoxPrompt -InputType 'Checkbox' -Message "Don't ask again." -DefaultValue=$true)
-- had to remove defaultvalue=$true

Show-AnyBox -Buttons 'OK' -MinWidth 200 -Prompt @(
(New-AnyBoxPrompt -InputType 'Link' -Message = 'My Files' -DefaultValue $env:USERPROFILE),
(New-AnyBoxPrompt -InputType 'Link' -Message = 'Reddit' -DefaultValue 'www.reddit.com' -ValidateNotEmpty),
(New-AnyBoxPrompt -InputType 'Link' -Message = 'Notepad' -DefaultValue 'notepad.exe')
)
got error - WARNING: Name must start with a letter or the underscore character (_), and must contain only letters, digits, or underscores.
The link showed as Equal signs with underlines.

the last thing that I am wondering if it is possible is with the datagrid - is it possible to have double click pass selection back to variable.

Thanks again for the module.

Double Click and Copy?

When using the GridData is there a way to have expose a double click instead of having to select a item/row then click ok or another button?

As for the copy I am using the "New-AnyBoxButton -Template 'CopyMessage'" command with gridData and I select an entry/row and select copy and a prompt display that "There is no message to copy." Am I trying to use the template in a manner that it was not intended for?
-- I am wanting to copy the selection to clipboard. If more then one property is selected include the property title in the copy. I understand this may be difficult to perform.

Thanks for the updates

2 Columns

Is it possible to create a 2 column form?

incomplete list of command using get-command -module AnyBox

Hello

after installing the module, it appear that the command get-command give an incomplete list:

`PS C:> get-command -module AnyBox

CommandType Name Version Source


Function Show-AnyBox 0.3.1 AnyBox`

if we do, we got mode command but the version and source is empty
`PS C:> get-command box

CommandType Name Version Source


Function New-AnyBoxButton
Function New-AnyBoxPrompt
Function Show-AnyBox 0.3.1 AnyBox`

:) not cool when trying to see what are the commands used by the module.

one more thing:
I had PSCX module, when i first execute "Install-Module -Name AnyBox" it blocked because there is a conflict on the function ConvertTo-Base64, PSCX had a function with the same name.

after removing it i can install anybox module.

thanks for the work done.
Tonic8

Status?

Has this project been abandoned?

Error as "cannot call a method on a null-valued expression"

This is an amazing module but I meet the following issue when use 'show-anybox' in a foreach method, any ideas for this? thanks a lot.

You cannot call a method on a null-valued expression.
At C:\Program Files\WindowsPowerShell\Modules\AnyBox\0.5.1\Public\Show-AnyBox.ps1:1490 char:13

  •         $form.Window.Activate()
    
  •         ~~~~~~~~~~~~~~~~~~~~~~~
    
    • CategoryInfo : InvalidOperation: (:) [], RuntimeException
    • FullyQualifiedErrorId : InvokeMethodOnNull

DataGrid Button? - Select All.

I am creating a menu selection using datagrid that I would like to have a button that selects all choices.

Is that possible and how. I have looked at cmdlet help and cannot find how but I could have overlooked it.

Thanks

Default value on set

Hi Donald,

I would like to thank you for AnyBox module, it's really great ๐Ÿ‘ and I have decided to use it in one of my projects :)

Still, I am experiencing one issue. If I try to set parameter -DefaultValue together with -ValidateSet and -ShowSetAs ComboBox, I am not getting the default value. With -ShowSetAs Radio, default value is working as expected.

$prompts = @(
        
            (New-AnyBoxPrompt -InputType Text -Message 'Username'),
            (New-AnyBoxPrompt -ValidateSet @('group1', 'group2', 'group3') -ShowSetAs ComboBox -DefaultValue 'group2' -Message 'Group'),
            (New-AnyBoxPrompt -ValidateSet @('5 GB', '10 GB') -ShowSetAs Radio -DefaultValue '10 GB' -Message 'Quota')
)

$buttons = @(

            'Save',
            'Quit'
            
)

$answer = Show-AnyBox -Title 'New User' -Prompts $prompts -Buttons $buttons

image

Could you please help me with this issue?

Regards
Viktor

Default DataGrid sorting column

Is there a way to set a default sorting column for DataGrids? Currently even if I reference a presorted array it appears to unorder it.

Button to copy

Haw can I create button or sth else to copy variable value without closing anybox?

And there is bug with datagrid. After use searchbox I cant sort columns.

dataGrid strange console output on exit

when the script finishes, there is a console output every time.

Name Value


Close False
grid_select

this is what I use:
`$anybox = New-Object AnyBox.AnyBox
$anybox.Title = 'Inactive Accounts'
$anybox.ContentAlignment = 'Center'
$anybox.MaxHeight = 1000

$anybox.GridData = @($90daysAgo = (Get-Date).AddDays(-90)
Get-ADUser -Property Name,lastLogonDate -Filter {lastLogonDate -lt $90daysAgo} -SearchBase 'OU=group,DC=contoso,DC=com' |
Where-Object { $_.DistinguishedName -notlike 'OU=Service Accounts,' }| Select Name,lastLogonDate, Enabled, DistinguishedName | Sort-Object -Property Name)

$anybox.Buttons = @(
New-AnyBoxButton -Text 'Close'
)
$anybox | Show-AnyBox`

I am a beginner with this sorry for such questions.

Lost Scroll Bar

After updating to the latest version, I seem to have lost the scroll bar, making very long prompts un-usable. Attempted to use the -ResizeMode property but this just gave me a lot white space on the right. Any way to get the scroll bar back, or alternatively any way to format the window into two columns of prompts?

Order of prompt groups

Is there a way to change the order of prompt groups? It seems like by default they're sorted alphabetically, is there a way to specify how you'd like them ordered?

For example,

$Box.Prompts =
@(
    New-AnyBoxPrompt -Group "Z" -InputType Text -Message "test"
    New-AnyBoxPrompt -Group "A" -InputType Text -Message "test"
)

Group "A" will show above group "Z" even though it's written afterwards.

Missing Messages And Comments With Version 0.5.0 Using New-Object

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:
image

However, with exactly the same code in version 0.5.0 I get:
image

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):
image

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

Powershell 7 Support

Are there plans to update this module for Powershell 7? Appreciate all the hard work that has been put into this already!

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.