$b_Random5_open = $false
# ... loop ...
if( bla -eq blub ){
# do your thing ...
$b_Random5_open = $true
$str_Random5_open = ... (substring or what you want)
}
if( ( $b_Random5_open -eq $true ) -and
( blap -eq blubidiblub ) )
{
# do your thing ...
write out $str_Random5_open
$str_Random5_open = ''
$b_Random5_open = $false
}
# ... pool ...