Hi guys,
I just started using Powershell Studio so please excuse me if got anything wrong or if I am missing something.
I just started to create a new GUI for a script by creating a new project. I would like to create a "Start" Window where you can choose a Topic f.e. Active Directory or Exchange and afterwards you are guided to a new window with scripts belonging to that topic.
Is it possible to keep everything in 1 window? I did it this way right now which opens a new window which kinda works but is not as nice as I would like to have it:
$btn_ActiveDirectory_Click={
#TODO: Place custom script here
Call-ActiveDirectory_psf
}
If this is not possible: Can I somehow close the first window in the same step as opening the new window?
I use the following for a "quit" button but I can not combine it with the call-AD - the window still is opened in the background:
$form_start.Close()
Last question for now:
I exported the script with my current status to ps1 and to .exe as well. When I run the script it already looks really nice but besides the GUI I created a Shell window is opened. Is there a way to just have the GUI showing up?
Thanks a lot in advance and have a great day!!
Childform + Background Window
Forum rules
Do not post any licensing information in this forum.
Any code longer than three lines should be added as code using the 'Select Code' dropdown menu or attached as a file.
Do not post any licensing information in this forum.
Any code longer than three lines should be added as code using the 'Select Code' dropdown menu or attached as a file.
- sFULkRpS1635685113
- Posts: 10
- Last visit: Fri Oct 29, 2021 12:28 pm
- dan.potter
- Posts: 709
- Last visit: Wed Nov 14, 2018 11:39 am
Re: Childform + Background Window
In a standard Form in PowerShell we are limited to one Window at a time because we can only use modal dialog, However there is a way around this and that is to use an MDI form.
Here is a demo or an MDI form that allows many Windows wit management.
Here is a demo or an MDI form that allows many Windows wit management.
- Attachments
-
- Demo-MDIForm.ps1
- Run this to see MDI form.
- (6.72 KiB) Downloaded 155 times
- sFULkRpS1635685113
- Posts: 10
- Last visit: Fri Oct 29, 2021 12:28 pm
Re: Childform + Background Window
Hi Guys,
Thanks for the fast responses. However I think that is not really what I am looking for. I created some screenshots to describe the issue a little bit better:
I want to create a "menu" where people can browse to the topic they would like to use a script:
Thanks for the fast responses. However I think that is not really what I am looking for. I created some screenshots to describe the issue a little bit better:
I want to create a "menu" where people can browse to the topic they would like to use a script:
- sFULkRpS1635685113
- Posts: 10
- Last visit: Fri Oct 29, 2021 12:28 pm
Re: Childform + Background Window
As you can see here each new window is opened "above" the previous one:
The last question i mentioned was regarding the Shell window in the background as you can see here:
The Quit button should close the whole script/tool for me - but it can only close the current window.The last question i mentioned was regarding the Shell window in the background as you can see here:
Re: Childform + Background Window
I posted an MDI form that will behave more like you want. Did you look at it? Al windows open in the main and can be forced to fill the client area. A close button on an MDI child can terminate the script.
You can also just call "exit" in your close event.
You can also just call "exit" in your close event.
- sFULkRpS1635685113
- Posts: 10
- Last visit: Fri Oct 29, 2021 12:28 pm
Re: Childform + Background Window
Hi jvierra,
Yes I just looked into it and you might be right. I will try to set this up for my script later today and then comeback to you.
At the first look it confused me a bit but it could be working.
Thanks for now
Do you have any idea regarding the Shell window in the background? Is there a solution or do I have to get used to this?
Yes I just looked into it and you might be right. I will try to set this up for my script later today and then comeback to you.
At the first look it confused me a bit but it could be working.
Thanks for now
Do you have any idea regarding the Shell window in the background? Is there a solution or do I have to get used to this?
Re: Childform + Background Window
I do not understand the question.BlaaaBlaaaBlaaa wrote:Hi jvierra,
Do you have any idea regarding the Shell window in the background? Is there a solution or do I have to get used to this?
To exit the application use this:
[environment]::Exit(99)
The 99 is just the exit code to be returned. It can be anything you like.
- sFULkRpS1635685113
- Posts: 10
- Last visit: Fri Oct 29, 2021 12:28 pm
Re: Childform + Background Window
Ok I will try to clarify that as well - sorry for my bad explanation.
When you run the .ps1 or .exe the GUI starts and everything looks fine. However in the background you can see a Powershell Window (the last screenshot i posted). I would like normal users to use the script as well and they might get confused by that "shell" window or close it which aborts the script.
Is there a way to hide this window or to start it minimized in the background?
When you run the .ps1 or .exe the GUI starts and everything looks fine. However in the background you can see a Powershell Window (the last screenshot i posted). I would like normal users to use the script as well and they might get confused by that "shell" window or close it which aborts the script.
Is there a way to hide this window or to start it minimized in the background?
Re: Childform + Background Window
If you hide the parent the child will also become hidden.
This is a design issue. Normally we would make the parent or control Window full screen and the children would be dialogs. THe kind of Window you are trying to build is not possible in PowerShell and it is contrary to Windows UI design.
The parent window cannot confuse the user because it cannot be activated.
This is a design issue. Normally we would make the parent or control Window full screen and the children would be dialogs. THe kind of Window you are trying to build is not possible in PowerShell and it is contrary to Windows UI design.
The parent window cannot confuse the user because it cannot be activated.