Created
October 21, 2016 11:08
-
-
Save PrateekKumarSingh/3c816beb274a2055c09b2337d376d489 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| function ScrollOnPromptUntil($UntilDateTime, $prePromptMsg, $postPromptMsg, $postPromptMsgOnNextLine) | |
| { | |
| $scroll = "/-\|/-\|" | |
| $idx = 0 | |
| Write-Host $prePromptMsg -NoNewline | |
| $origpos = $host.UI.RawUI.CursorPosition | |
| do | |
| { | |
| $host.UI.RawUI.CursorPosition = $origpos | |
| Write-Host $scroll[$idx] -NoNewline | |
| $idx++ | |
| if ($idx -ge $scroll.Length) | |
| { | |
| $idx = 0 | |
| } | |
| Start-Sleep -Milliseconds 100 | |
| } until ((Get-Date) -ge (Get-Date $UntilDateTime)) | |
| Write-Host "`b$postPromptMsg`r" -NoNewline | |
| # It's over - clear the activity indicator. | |
| $origpos.X = 0 | |
| if ($postPromptMsgOnNextLine -eq $true) { | |
| $origpos.Y += 1 | |
| } | |
| $host.UI.RawUI.CursorPosition = $origpos | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment