Sub Globals
Dim words(0) As string
HKCUkey = "Software\RAD\SMS Viewer"
Dummy = ""
End Sub
Sub App_Start
Hardware1.New1
SMS.New2
Intercept.New1
Reg.New1
' Create the registry key if not allready exists
Reg.RootKey(reg.rtCurrentUser)
ErrorLabel(NotCreatedYet)
Dummy = reg.GetValue(HKCUkey,"From")
Goto RegistryCreatedOrExisting
NotCreatedYet:
reg.CreateSubKey("",HKCUkey)
RegistryCreatedOrExisting:
Form1.Show
Form1.Text = ""
Timer2.Enabled = False
Timer1.Enabled = True
Timer1.Interval = 1000
End Sub
Sub Intercept_MessageReceived
Dim frm,tel,txt,tijd,str,wordnr,line,linenr,linestringcount
TimeFormat("HH:mm")
Sms.Value = Intercept.ReceivedMessage
frm = SMS.From
txt = SMS.Body
tijd = Time(SMS.DateReceived)
Label1.Text = frm : Reg.SetStringValue(HKCUkey,"From",frm)
Label2.Text = txt : Reg.SetStringValue(HKCUkey,"Text",txt)
Label3.Text = tijd : Reg.SetStringValue(HKCUkey,"Received at",tijd)
tel = SubString(frm,StrIndexOf(frm,"<",0)+1,StrLength(frm)-StrIndexOf(frm,"<",0)-2)
frm = SubString(frm,1,StrLength(frm)-StrIndexOf(frm,Chr(34),1)+1)
Reg.SetStringValue(HKCUkey,"Name",frm)
Reg.SetStringValue(HKCUkey,"Tel",tel)
str = "AAA"
wordnr = 0
line = ""
linenr = 0
linestringcount = Reg.GetValue(HKCUkey,"Line String Count")
Do While str <> ""
nr = nr + 1
str = Word(txt,nr," ","")
If str <> "" Then
If StrLength(line & " " & str) > linestringcount Then
linenr = linenr + 1
Reg.SetStringValue(HKCUkey,"Line " & linenr,line)
line = str
Else
If line = "" Then
line = str
Else
line = line & " " & str
End If
End If
End If
Loop
If line <> "" Then
linenr = linenr + 1
Reg.SetStringValue(HKCUkey,"Line " & linenr,line)
End If
For I = linenr + 1 To 15
Reg.SetStringValue(HKCUkey,"Line " & I,"")
Next I
End Sub
Sub Timer1_tick
Timer1.Enabled = False
Hardware1.ShowTodayScreen
Timer2.Enabled = True
Timer2.Interval = 60000 ' 1 minuut
End Sub
Sub Timer2_tick
End Sub
Sub Word(strString,wordNr,separator,default)
Dim Result, words(0) As string
If separator = "" Then separator = "|"
Result = default
words() = StrSplit(strString & separator, separator)
If wordNr <= ArrayLen(words())-1 Then Result = words(wordNr-1)
Return Result
End Sub