Microsoft Small Basic

Program Listing: LLJ132
' SmallBasic Version 1.2
' Program: Loading Text
' Changelog: 15.12
' Author: Pappa Lapub
' Website: https://social.msdn.microsoft.com/Forums/en-US/3036ed92-c3db-4353-9666-74e7aacb4cb9/how-do-i-make-a-loading-text-in-small-basic
' ImportURL: http://smallbasic.com/program/?
' Extension: ---
' Comment:
'
' Variables:
' ToDo:
' ================================================================================
txt = "Merry Christmas"
len = Text.GetLength(txt)
spc = Text.GetCharacter(32)
arrMorse = "A=.-;B=-...;C=-.-.;D=-..;E=.;F=..-.;G=--.;H=....;I=..;J=.---;K=-.-;L=.-..;M=--;N=-.;O=---;P=.--.;Q=--.-;R=.-.;S=...;T=-;U=..-;V=...-;W=.--;X=-..-;Y=-.--;Z=--.."
snd = "http://a.tumblr.com/tumblr_lj2igdReQM1qi5p4jo1.mp3" ' RySa-MXML, 5:02, 6.92MB
If snd <> "" Then
Sound.Play(snd)
EndIf

Timer.Interval = 1000 * Math.GetRandomNumber(5)
Timer.Tick = OnTimerTick

' ////////// EVENT \\\\\\\\\\
Sub OnTimerTick
char = Text.ConvertToUpperCase(Text.GetSubText(txt, n,1))
If Array.ContainsIndex(arrMorse, char) Then ' A;...;Z; (65, ..., 90)
TextWindow.Write(arrMorse[char] + spc)
EndIf
If n >= len Then
TextWindow.WriteLine("")
EndIf
n = Math.Remainder(n, len) + 1
Timer.Interval = 1000 * Math.GetRandomNumber(5)
EndSub