'Strange' behaviour of porgressbar

Archived support forum for customers who once purchased a PrimalForms product license. This forum is locked.
This topic is 12 years and 2 weeks old and has exceeded the time allowed for comments. Please begin a new topic or use the search feature to find a similar but newer topic.
User avatar
Kenneth
Posts: 19
Last visit: Sun Jan 24, 2021 11:10 pm

'Strange' behaviour of porgressbar

Post by Kenneth »

Hi, I got the progressbar to work with the 'marquee' style. I use it when starting an external exe, which has an unknown execution time. This works fine, but when I insert an empty do-while function to repeat as long as the process run, then the progressbar doesn't show up, until AFTER the do-while has exited ? ------------------------------start-process $exefile -ArgumentList $arguments $buttonSplitInvoices.Enabled=0#Initialize the Progress Bar
$progressbar1.Style='Marquee'$progressbar1.MarqueeAnimationSpeed=40$progressbar1.Visible=1do {} while ((Get-Process "pcscmd" -ErrorAction SilentlyContinue) )-----------------------Can you help me whit this one ?Best regards,Kenneth
User avatar
davidc
Posts: 5913
Last visit: Mon Jul 08, 2019 8:55 am
Been upvoted: 2 times

'Strange' behaviour of porgressbar

Post by davidc »

I recommend reading the following blog article: http://www.sapien.com/blog/2011/07/15/p ... ive-loops/ David
David
SAPIEN Technologies, Inc.
User avatar
davidc
Posts: 5913
Last visit: Mon Jul 08, 2019 8:55 am
Been upvoted: 2 times

'Strange' behaviour of porgressbar

Post by davidc »

I also recommend getting the process object and checking if the process completed.$process = Start-Process -FilePath $processPath -PassThruif($process.HasExited){ #The Process
finished } you might also want to look at using a timer to check the process instead of looping. David
David
SAPIEN Technologies, Inc.
This topic is 12 years and 2 weeks old and has exceeded the time allowed for comments. Please begin a new topic or use the search feature to find a similar but newer topic.