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.

Reply via email to