4

Is anyone familiar with how to make the progress bar show a "moving" effect in a marque-style while performing a script task in Powershell Studio 2012?

I do not want it to display a percentage or something. When I hit a button it will start to load.... and when finished it will stop. The most convenient method would be to have two functions, "Load" and "Done".

Is this possible?

Anthony Neace
  • 25,013
  • 7
  • 114
  • 129
user2782999
  • 385
  • 1
  • 7
  • 23

2 Answers2

2

You could use Write-Progress -Activity "Doing stuff" -Status "Working" -PercentComplete $X, then vary X from 25-99 so the progress bar does that funky fill/reset thing.

The default Write-Progress cmdlet doesn't have a marquee style though.

Eris
  • 7,378
  • 1
  • 30
  • 45
1

lets say you got a button that runs a code and perform some kind of task....
Example:

$buttonStart_Click={
    $progressbar1.MarqueeAnimationSpeed = 5 #this set the speed of the animation to 5
    #your code here...
    $progressbar1.MarqueeAnimationSpeed = 0 #this will stop the animation
}

One crucial thing though, if your code will do some "heavy" tasks, most likely the form and the progressbar with it will freeze until it finishes the task. so no point of having a bar is it.
simple and lazy solution will be this line:

[System.Windows.Forms.Application]::DoEvents()

this will unfreeze the form while the code runs the task. check the Sapien's spotlight of the bar.

Sagiv b.g
  • 30,379
  • 9
  • 68
  • 99