In the attached files I have a script for Powershell studio.
The code is for a stopwacht function.
The problem is that the first time I start the stopwatch via the startbutton it works good but when I press the stop button and then again on the start button it added up with 2 seconds instead of 1.
Can someone please help me/improve my script?
Thanks in advance.
Need some help with script for stopwatch
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: Need some help with script for stopwatch
Why are you creating all of those variables? The timer always holds the value. All you have to do is reset it when you start and then get the value after it stops.
I recommend reading the timer documentation to understand how timers work.
I recommend reading the timer documentation to understand how timers work.
Re: Need some help with script for stopwatch
I'm not that expierenced so that is why I'm asking for help.
Can you please give me an example script or change my script?
Can you please give me an example script or change my script?
Re: Need some help with script for stopwatch
Attached.
- Attachments
-
- Demo-Timer.psf
- (43.65 KiB) Downloaded 85 times
Re: Need some help with script for stopwatch
Here is a cleaner and simpler way.
- Attachments
-
- Demo-Timer.psf
- (48.67 KiB) Downloaded 107 times