Error message form
Error message form
Good morning,I'd like to create a very simple form with just a Label inside.I'd like that form to be called by another script in the event of an error.This form would stay open for viewing for 5-7 seconds, then close and return to the calling script.The only thing I haven't solved yet is where to put my start-sleep statement followed by my form.close() statement.Could you please advise.Thank you.
Error message form
You need to add a Timer Control, which you can have trigger the form closure after a specified amount of time. Please see the Spotlight on the Timer Control blog article for more details.If you use the start-sleep it will freeze the form and possible prevent it from displaying the label. David
David
SAPIEN Technologies, Inc.
SAPIEN Technologies, Inc.
Error message form
Nope. No go on this one. Blog didn't have enough info. No details for what I want. Tried to piece together something based on it but no use.Here's my code:$labelTest_Click={ #TODO: Place custom script here $totaltime = 7 $script:starttime = (Get-Date).addseconds($totaltime) $timer1.Start()}$timer1_Tick={ #TODO: Place custom script here [timespan]$span = $script:starttime - (Get-Date) if($span.TotalSeconds -le 0){ $timerupdate.stop() } $form1.Close()
Error message form
Set the timer's interval property so it is 6 seconds (6000) and on the Tick event you simply close the form: $timer1_Tick={ $form1.Close()}
David
SAPIEN Technologies, Inc.
SAPIEN Technologies, Inc.
Error message form
Ahhh. That was perfect. Thank you very much once again. And so much simpler that what I was trying to do.Sorry about the brevity in my previous comments. Deadlines and pressures.Apologies.