'Strange' behaviour of porgressbar

Archived support forum for customers who once purchased a PrimalForms product license. This forum is locked.
User avatar
Kenneth
Posts: 19
Joined: Sun Feb 26, 2012 9:30 pm

'Strange' behaviour of porgressbar

Post by Kenneth » Thu Mar 08, 2012 9:12 pm

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: 5839
Joined: Thu Aug 18, 2011 4:56 am

'Strange' behaviour of porgressbar

Post by davidc » Fri Mar 09, 2012 6:31 am

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: 5839
Joined: Thu Aug 18, 2011 4:56 am

'Strange' behaviour of porgressbar

Post by davidc » Fri Mar 09, 2012 6:47 am

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.