To help you better we need some information from you.
*** Please fill in the fields below. If you leave fields empty or specify 'latest' rather than the actual version your answer will be delayed as we will be forced to ask you for this information. ***
Product, version and build: PowerShell Studio 2018 5.5.150
32 or 64 bit version of product: 64
Operating system: Windows 10
32 or 64 bit OS: 64
*** Please add details and screenshots as needed below. ***
I'm trying to tell my form "2017Warp" to automatically start a timer named timerUpdate when the form is loaded. I have set the timer to 5 seconds for testing. When the timer expires, I want to perform a click on the form's start button ($buttonStart). My code is below. My issue is I can't get the timer to start.
$form2017WarpDr_Load= {
$ProgressLabel.Text = "This will terminate any active sessions. Press Start to continue"
$progress.Visible = $false
$LabelTime.Text = "Will start automatically in: {0:D1}" -f $TimeoutSeconds
$script:StartTime = (Get-Date).AddSeconds($TimeoutSeconds)
$timerUpdate.Start()
}
$TimeoutSeconds = 5
$timeout_Tick = {
#TODO: Place custom script here
[TimeSpan]$span = $script:StartTime - (Get-Date)
$LabelTime.Text = "Will start automatically in: {0:N0}" -f $span.TotalSeconds
If ($span.TotalSeconds -le 0)
{
$buttonStart.PerformClick()
}
}
DO NOT POST SUBSCRIPTIONS, KEYS OR ANY OTHER LICENSING INFORMATION IN THIS FORUM
Starting a timer on load
Forum rules
Do not post any licensing information in this forum.
Any code longer than three lines should be added as code using the 'Select Code' dropdown menu or attached as a file.
Do not post any licensing information in this forum.
Any code longer than three lines should be added as code using the 'Select Code' dropdown menu or attached as a file.
Re: Starting a timer on load
[TOPIC MOVED BY MODERATOR]
If the code above is all of what you have make sure that you have a click event for the buttonStart button.
If the code above is all of what you have make sure that you have a click event for the buttonStart button.