Auto Re refresh

Sep 9, 2014 at 6:01 PM
Is there away to apply an auto refresh within some code? for example I have several log files in the background that i need the GUI to read every 5 mins and then display the data.

Sep 11, 2014 at 5:50 PM
Edited Sep 11, 2014 at 5:50 PM
The PowerShellCommand commands do this.
Register-PowerShellCommand { <# some code/work #> } -Interval "00:05:00" -Run
If the timing matters, you can register it without the -Run parameter, and then Start-PowerShellCommand later. There are several examples of this in the \Examples folder, plus at least one each in the help for Register-PowerShellCommand and Start-PowerShellCommand (although it may be duplicated in the examples folder).
Sep 11, 2014 at 7:09 PM
Great thanks.

Once you have written the application how do you publish it? so for example share it with others so they can double click and its shows the desired application?

Apr 11, 2015 at 8:47 AM
Edited Apr 11, 2015 at 8:48 AM
You're writing PowerShell scripts, not applications, so you're going to have a hard time getting a "double click to launch" feature. I don't really recommend it, but you could make it a .cmd file (which is double-click-able), and launch PowerShell from within it, if you wrote something like this and saved it as "YourApp.cmd"
REM <#
copy %0 %0.ps1
PowerShell.exe -ExecutionPolicy Unrestricted -NoProfile -NoLogo -WindowStyle Hidden -Command "&{Set-Alias REM Write-Host; .\%0.ps1}"
del %0.ps1
REM #>
### Your PowerShell script goes below here.
### I've put a couple of lines as an example ...
Import-Module ShowUI
New-Button "OK" -IsDefault
New-Button "OK" -IsDefault -On_Click { $window.Close() } -Show