Microsoft Small Basic
Program Listing:
Embed this in your website
<object id='sbapp' data='data:application/x-silverlight-2,' type='application/x-silverlight-2' width='640' height='480'> <param name='source' value='http://smallbasic.com/program/ClientBin/SBWeb.xap'/> <param name='onError' value='onSilverlightError' /> <param name='background' value='white' /> <param name='minRuntimeVersion' value='3.0.40624.0' /> <param name='autoUpgrade' value='true' /> <param name='initParams' value='programId=GQR102' /> </object>
'Alarm Clock program written by Cody Frazier.
'This is a basic alarm clock that I have put together because I could not find one that
'was sufficent for me. This can be configured easily. The few things to change are the
'music file, the display messages and the length of time for the snooze.
start
:
TextWindow
.
Title
=
"Alarm Clock"
TextWindow
.
Write
(
"What hour do you want the alarm to go off?: "
)
hour1
=
TextWindow
.
ReadNumber
(
)
TextWindow
.
Write
(
"What minutes do you want the alarm to go off?: "
)
minutes1
=
TextWindow
.
ReadNumber
(
)
TextWindow
.
Hide
(
)
'Source of music file
music
=
Program
.
Directory
+
"\Disturbed - The Night.mp3"
hour
:
If
(
hour1
=
Clock
.
Hour
)
Then
Goto
mins
EndIf
mins
:
If
(
minutes1
=
Clock
.
Minute
)
Then
TextWindow
.
Show
(
)
'You can change the message for when the alarm is going off.
TextWindow
.
Write
(
"YOUR ALARM IS GOING OFF!!"
)
Sound
.
Play
(
music
)
else
Goto
hour
endif
'The program will clear the message and display the snooze message after 3 seconds.
Program
.
Delay
(
3000
)
TextWindow
.
Clear
(
)
TextWindow
.
Write
(
"SNOOZE?"
)
snooze1
=
TextWindow
.
Read
(
)
snooze
:
If
(
snooze1
=
""
)
Then
Sound
.
Stop
(
music
)
textwindow
.
Clear
(
)
'The length of time the program will "snooze".
Program
.
Delay
(
300000
)
Goto
resume
else
Sound
.
Stop
(
music
)
textwindow
.
Clear
(
)
Goto
start
endif
resume
:
Sound
.
Play
(
music
)
TextWindow
.
Write
(
"SNOOZE?"
)
snooze2
=
TextWindow
.
Read
(
)
If
(
snooze2
=
""
)
Then
Goto
snooze
TextWindow
.
Clear
(
)
else
Sound
.
Stop
(
music
)
textwindow
.
Clear
(
)
Goto
start
EndIf
Copyright (c) Microsoft Corporation. All rights reserved.