Answer the question
In order to leave comments, you need to log in
Powershell. How to implement background loop execution in a gui script?
Good afternoon.
I ran into a problem, hope you can help me.
There is a GUI script. It implies the constant execution of the cycle in the background of the application. But I don't understand how to do it.
For example, the script:
$form = New-Object WindowsApplication1.Form1
бла бла бла
$form.ShowDialog()
while ($ExitFlag -eq $False) {
Write-Host "новый цикл обработки сообщений" -ForegroundColor Green
}
Answer the question
In order to leave comments, you need to log in
Maybe try just Show() instead of ShowDialog().
ShowDialog - shows a modal form with blocking further execution until return.
Show will simply show the form and execution will continue.
In this case, the properties and methods of the form itself can be accessed from the calling code.
The disadvantage is that it will be necessary to catch the closing event from the calling code.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question