Hi all
im still new to Powershell scripting on this level so I know my code is not great but im having a big issue with the GUI freezing. when I run the code in powershell studio the GUI works fine and updated the progress bars and debug log, but ive just tested it after I built it to a .exe and the GUI is freezing when I deploy VMs and the GUI doesn't update until the VM is deployed (when it exits the while loop). please can someone help with my coding if there is a better way to do what im trying to do then please let me know what that is.
many thanks in advance
issue with GUI Freezing
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.
- sam.wrighton
- Posts: 14
- Last visit: Tue Sep 27, 2016 4:42 am
issue with GUI Freezing
Last edited by sam.wrighton on Thu Nov 12, 2015 12:18 am, edited 1 time in total.
Re: issue with GUI Freezing
Hi Sam. A couple of suggestions. TO post a project you need to zip the whole project folder. There are files missing from you post that are necessary for running you project.
To understand how to prevent a form from freezing see the following: https://www.sapien.com/blog/?s=responsive+forms
To understand how to prevent a form from freezing see the following: https://www.sapien.com/blog/?s=responsive+forms
Re: issue with GUI Freezing
I took a quick look at you code. It is 8000+ lines of linear code. There is no way we can understand what this code is doing in a forum environment. You need to isolate the code in question and post that snippet that is causing the issues.
I can make a couple of suggestions that you can think about for future projects.
1. Consider learning a bit about the basics of program design.
2. Think about how to use a single function to replace repeated copies of code.
3. Controls and tabs can be generated dynamically at run time.
4. Successful programs are based on a well defined data model used for describing and storing the programs data.
The current forms program could be greatly simplified but it would probably not be worth it if it is currently working.
Your project, if well designed, would likely be less that 500 lines of code.
For this program just isolate the event that is causing you the freezing. You can just reference it by event name.
I can make a couple of suggestions that you can think about for future projects.
1. Consider learning a bit about the basics of program design.
2. Think about how to use a single function to replace repeated copies of code.
3. Controls and tabs can be generated dynamically at run time.
4. Successful programs are based on a well defined data model used for describing and storing the programs data.
The current forms program could be greatly simplified but it would probably not be worth it if it is currently working.
Your project, if well designed, would likely be less that 500 lines of code.
For this program just isolate the event that is causing you the freezing. You can just reference it by event name.
- sam.wrighton
- Posts: 14
- Last visit: Tue Sep 27, 2016 4:42 am
Re: issue with GUI Freezing
Hi
thanks for the reply ive attached the whole project in this post
I understand my code is far from perfect but this is what I understand at this moment in time. if you or anyone could help further I would be very thankful
thanks for the reply ive attached the whole project in this post
I understand my code is far from perfect but this is what I understand at this moment in time. if you or anyone could help further I would be very thankful
Last edited by sam.wrighton on Thu Nov 12, 2015 12:18 am, edited 1 time in total.
- sam.wrighton
- Posts: 14
- Last visit: Tue Sep 27, 2016 4:42 am
Re: issue with GUI Freezing
hi
I my 1st post I said that when it is deploy VMs it is freezing In the while loop
Globals.ps1 line 19951 is the 1st loop
there are while loops in the
Deploy-2ndBatch
Deploy-3rdBatch
Deploy-4thBatch
functions
I my 1st post I said that when it is deploy VMs it is freezing In the while loop
Globals.ps1 line 19951 is the 1st loop
there are while loops in the
Deploy-2ndBatch
Deploy-3rdBatch
Deploy-4thBatch
functions
- sam.wrighton
- Posts: 14
- Last visit: Tue Sep 27, 2016 4:42 am
Re: issue with GUI Freezing
hi
I looked at jobs but this wont give me the VMware task it, it will give me the job ID so I wont be able to check vCenter if the deploy has been successful
I looked at jobs but this wont give me the VMware task it, it will give me the job ID so I wont be able to check vCenter if the deploy has been successful
Re: issue with GUI Freezing
Jobs will do exactly what you need but you will have to redesign your forms to run more independently.
Sorry but there is no simple solution. Try running your script as a PS file with no forms and launching it from the form. Dump the configuration to an XML file that the script can read.
Adjusting the script to use correct programming rules would allow you to run the function in a job. Read the blog posts to learn how to do this.
Sorry but there is no simple solution. Try running your script as a PS file with no forms and launching it from the form. Dump the configuration to an XML file that the script can read.
Adjusting the script to use correct programming rules would allow you to run the function in a job. Read the blog posts to learn how to do this.