The lines of the thread/program list have the following structure:
Forum user | date | part of thread link | program IDs of the thread's Small Basic Programs
Tryhest, [200404] , 5e752003-2e35-4abc-a393-2363ba75c497/challenge-of-the-month-april-2020,HRT413,DSD647,MTJ275,TKK350,XGD977,RPB297-0,KRR126,LQT869,DSD647-2,DSD647-3,QFW939,
The full thread link looks like this
https://social.msdn.microsoft.com/Forums/azure/en-US/5e752003-2e35-4abc-a393-2363ba75c497/challenge-of-the-month-april-2020?forum=smallbasic
challenge-of-the-month-april-2020
The following program creates the thread list. Clicking on the list entry takes you directly to the thread.
Before starting, please download the file 275338-forumpage.txt into the program directory and rename it to forumpage.txt
' This program can list up program IDNo in the Small Basic Forum threads. by NaochanON 2016/05/06 FXG725-0 '
' This uses forumthreads name list (below Forumpath ) and add IDNos list and save it named as " IDNos.txt " '
' It takes about 30min (my PC) to get all ID numbers in all threads. '
' This needs Litdev Extension '
Controls.ButtonClicked=Onclicked
init()
show_list()
LDControls.ListBoxItemChanged = OnListBoxItemChanged
Sub OnListBoxItemChanged
_thread=list[LDControls.LastListBoxIndex]
_thread=text.GetSubTextToEnd(_thread,Text.GetIndexOf(_thread,",")+2)
crP= Text.GetIndexOf(_thread,",")
_thread=text.GetSubTextToEnd(_thread,Text.GetIndexOf(_thread,",")+2)
crP= Text.GetIndexOf(_thread,",")
threadname= Text.GetSubText(_thread,1,crP-1)
LDProcess.Start(head+threadname+tail,"")
EndSub
Sub Onclicked
nm= Controls.GetButtonCaption(Controls.LastClickedButton)
If nm= "IDGet" Then
' The following line could be harmful and has been automatically commented. '
File.DeleteFile(IDListpath)
Get_IDNo()
ElseIf nm="Search" then
Search_Threads()
elseif text.IsSubText(nm,"Show") then
show_list()
EndIf
EndSub
Sub show_list
' The following line could be harmful and has been automatically commented. '
If LDFile.Exists(IDListpath) Then
' The following line could be harmful and has been automatically commented. '
List= LDFile.ReadToArray(IDListpath)
box[2]=LDControls.AddListBox(List,1170,650)
Shapes.Move(box[2],10,35)
Else
Shapes.SetText(msg,"File not exists. Push IDGet button ")
EndIf
EndSub
Sub Search_Threads
SelectedList=""
MM=0
' The following line could be harmful and has been automatically commented. '
RD= File.ReadContents(IDListpath)
word= text.ConvertToLowerCase(Controls.GetTextBoxText(box[1]))
crP= Text.GetIndexOf(RD,CRLF)
While crP>0
_thread= Text.GetSubText(RD,1,crp-1)
If Text.IsSubText(text.ConvertToLowerCase(_thread),word) Then
MM=MM+1
Selectedlist[MM]=_thread
EndIf
RD= Text.GetSubTextToEnd(RD,crP+2)
crP= Text.GetIndexOf(RD,CRLF)
EndWhile
box[2]=LDControls.AddListBox(SelectedList,1170,650)
Shapes.Move(box[2],10,35)
List=selectedlist
EndSub
Sub Get_IDNo
For J=1 to MaxNMB
' The following line could be harmful and has been automatically commented.'
_thread= File.ReadLine(Forumpath,J) ' Pappa Lapub, [150430] , fef3c43.... ion-updates '
crP= Text.GetIndexOf(_thread,",")
Creator= Text.GetSubText(_thread,1,crP-1)
_thread=Text.GetSubTextToEnd(_thread,crP+1)
threadname=text.GetSubTextToEnd(_thread,Text.GetIndexOf(_thread,",")+2)
RD= Network.GetWebPageContents( head+threadname+tail)
Get_IDNos_IntheThread()
_thread=Creator+","+_thread+","+sumNMB
shapes.SetText(msg,j+" /"+MaxNMB)
' The following line could be harmful and has been automatically commented.'
File.WriteLine(IDListpath,J,_thread)
endfor
EndSub
Sub Get_IDNos_IntheThread
sumNMB="" ' sumNMB is IDNo List'
mesP= Text.GetIndexOf(RD,DQ+"messageContent"+DQ)
While mesP>0
RD=Text.GetSubTextToEnd(RD,mesp)
stP= Text.GetIndexOf(RD,DQ+"body"+DQ)+8
endP= Text.GetIndexOf(RD,"</div>")
_mes= Text.GetSubText(RD,stp,endP-stp)
Len= Text.GetLength(_mes)
For i=1 To Len
id1=Text.GetSubText(_mes,i,1)
If text.IsSubText(alfa,id1) Then ' N '
id2=Text.GetSubText(_mes,i+1,1)
If text.IsSubText(alfa,id2) Then 'NM '
id3=Text.GetSubText(_mes,i+2,1)
id4=Text.GetSubText(_mes,i+3,3)
If text.IsSubText(alfa,id3) and 0<id4 and id4<1000 and text.IsSubText(id4," ")="False" and text.IsSubText(id4,".")="False" then 'NMB567'
NMB= Text.GetSubText(_mes,i,6)
If Text.GetSubText(_mes,i+6,1)="-" then
NMB= Text.GetSubText(_mes,i,9) ' EX: NMB567-1) </p>'
If text.IsSubText(NM,Text.GetSubText(NMB,9,1))="False" then
NMB= Text.GetSubText(_mes,i,8) ' NMB567 - 1 '
EndIf
EndIf
If text.IsSubText(NMB,"ABC123")="False" and Text.IsSubText(sumnmb,NMB+",")="False" then ' omit same IDNO '
sumnmb=sumnmb+NMB+","
EndIf
i=i+text.GetLength(NMB)
EndIf
EndIf
EndIf
EndFor
RD= Text.GetSubTextToEnd(RD,endp+2)
mesP= Text.GetIndexOf(RD,DQ+"messageContent"+DQ)
endwhile
EndSub
Sub init
GraphicsWindow.Width=1200
GraphicsWindow.Height=700
GraphicsWindow.BackgroundColor="#C7DC68"
GraphicsWindow.BrushColor="Navy"
GraphicsWindow.DrawText(15,15,"Get all IDNos in the thread")
Controls.AddButton("IDGet",200,10)
Controls.AddButton("Show original",260,10)
GraphicsWindow.DrawText(430,15,"Search word")
box[1]=Controls.AddTextBox(520,10)
Controls.SetSize(box[1],160,25)
Controls.AddButton("Search",700,10)
'------------------------------------------------------------------------- '
GraphicsWindow.BrushColor="Red"
GraphicsWindow.FontSize=22
msg= Shapes.AddText(" Wait !!!! ")
Shapes.Move(msg,200,200)
GraphicsWindow.BrushColor="Navy"
GraphicsWindow.FontSize=12
'------------------------------------------------------------------------- '
CRLF= Text.GetCharacter(13)+Text.GetCharacter(10)
head="https://social.msdn.microsoft.com/Forums/en-US/"
Hlen= Text.GetLength(head)
tail="?forum=smallbasic"
'------------------------------------------------------------------------- '
Forumpath= Program.Directory+"\forumpage.txt"
IDListpath= Program.Directory+"\IDNos.txt"
DQ= Text.GetCharacter(34)
alfa="ABCDEFGHIJKLMNOPQRSTUVWXYZ"
NM="0123456789"
' The following line could be harmful and has been automatically commented.'
'MaxNMB= 5078 ' '<--- Maxnmb is 5078 on 2020/04/25'
MaxNMB=LDFile.Length(Forumpath) '<--- need Litdev extension or Maxnmb is 4056?? on 2015/05/06 '
EndSub
The program also has a search function for thread titles, users and time ranges. The search results are presented in a list.