Jeff,
Oops, sorry about the missing parens. Of course I didn't actually run
this (smile).
If you look at the documentation for StartTimer, it says:
"Creates and returns a timer ID. You can use the timer ID in the
StopTimer method to stop the timer."
In the StopTimer where it describes the single parameter it says "ID of
a timer created by the StartTimer method"
I think this is pretty clear isn't it?
Doug
On 3/8/2012 1:33 PM, Jeff Weiss wrote:
Thanks doug and Jeff.
Doug, I got your script to work by adding parens here:
timer = StartTimer( Result, "MyTimer")
The only reason I did this was to learn how to use
StopTimer.
The thing I didn't realize when reading the App manual was that
We needed to use a variable
"Timer"
When setting up the timer so that this same variable could be used to
stop the timer.
StopTimer timer
This is the kind of thing that I have difficulty understanding without
a real, working example.
Thanks again for this example!
Jeff Weiss
*From:*Doug Geoffray [mailto:[email protected]]
*Sent:* Thursday, March 08, 2012 9:01 AM
*To:* [email protected]
*Subject:* Re: using stopTimer
Jeff,
Jeff Bishop is correct. I quickly reworked your app...this would do
what you want. But of course it would be better to just check your
Result before setting the timer in the first place (smile).
Doug
Dim myHotkey : Set myHotkey =
Keyboard.RegisterHotkey("Alt-Control-Shift-I","GetTime")
Dim Result
Dim Timer
Function GetTime()
' This timer will execute the MyTimer function in a specified time
Result = InputBox("Enter number of seconds: ", "Timer")
Result = Result & "000"
timer = StartTimer Result, "MyTimer"
If Result > 10000 Then
StopTimer timer
Speak "sorry, no times longer than 10 seconds! "
Sleep 300
End If
End Function
' Set a timer
Sub MyTimer()
PlaySound("TimerStopDone.wav")
Sleep 3500
Speak "Your time is up! "
End Sub
On 3/8/2012 9:44 AM, Jeff Weiss wrote:
I want to use StopTimer in this script.
What is wrong with the line:
StopTimer "MyTimer"
Dim myHotkey : Set myHotkey =
Keyboard.RegisterHotkey("Alt-Control-Shift-I","GetTime")
Dim Result :
Function GetTime()
' This timer will execute the MyTimer function in a specified time
Result = InputBox("Enter number of seconds: ", "Timer")
Result = Result & "000"
StartTimer Result, "MyTimer"
If Result > 10000 Then
' here is the problem line
StopTimer "MyTimer"
Speak "sorry, no times longer than 10 seconds! "
Sleep 300
End If
End Function
' Set a timer
Sub MyTimer()
PlaySound("TimerStopDone.wav")
Sleep 3500
Speak "Your time is up! "
End Sub
Jeff Weiss, CVRT
Rehabilitation Teacher
World Services for the Blind
2811 Fair Park Blvd.
Little Rock, AR 72204
http://www.lwsb.org
The Mission of WSB is to educate adults who are blind or visually
impaired for careers and independent lives.