Quantcast
Channel: PowerShell.com – PowerShell Scripts, Tips, Forums, and Resources
Viewing all articles
Browse latest Browse all 6937

ProgressBar will not be updated

$
0
0

Good morning,

i have created the following script. The ProgressBar is only updated at the end of the ForEach-Lopp and not while the loop is running. In $global:aus_list there are datasetnames of one specific directory.

Can someone give me a hint, what i have to do to update the progressbar whilke the loop is running ?

Thx in advance, Inbgolf

 

# --- here is the code-snippet

$xaml = @"
<Window
  xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
  xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
...
    <ProgressBar Name="Bar_1"   Margin="0,0,10,5"   ...  Height="15" />
...
</Window>
"@
$reader    = [System.XML.XMLReader]::Create([System.IO.StringReader] $xaml)
$fenster_1 = [System.Windows.Markup.XAMLReader]::Load($reader)
...

$bar_1        = $fenster_1.FindName('Bar_1')
$aktrename    = {
    $i                 = 1
    $tmp_3  = @($global:aus_list) | ForEach-Object {
        ...
        $oldname   = ...
        $newName   = ...
        Rename-Item -Path $oldname -NewName $newName

        $proz        = 100 * $i / $global:anzahl
        $bar_1.Value = $proz
        $i++
    }
}
$menu_rename.add_Click($aktrename)


Viewing all articles
Browse latest Browse all 6937

Trending Articles