#include "FiveWin.ch"
function Main()
// link for second test
//local cPost := "f=6&t=42239&sid=4290062a3f768e4ee2ba52d66b669097#p253728"
local cPost := "f=3&t=42249&sid=844b9e3e8d8f3961169850370d02d06b#p253781"
Local cZoeksub1_start,cZoeksub1_end
Local cZoeksub1_strip_link_start := 'a href="/'
Local cZoeksub1_strip_link_end := '"'
Local cText, cTemp, cTempSub, cData
Local nSubmenu, nTel:=1
Local aData:={}
// See content
cText = WebPageContents( "https://fivetechsupport.com/forums/viewtopic.php?http://fivetechsupport.com/forums/viewtopic.php?" + cPost )
FW_memoEdit(cText)
cText = strtran(cText,"<br />",CRLF)
//cZoeksub1_start := 'id="p253728"'
cZoeksub1_start := 'id="p253781"'
cZoeksub1_end := '"divider"'
cText = textertussen( cText, cZoeksub1_start,cZoeksub1_end, 1 )
// Topic selected
//cZoeksub1_start := 'id="p253728"'
cZoeksub1_start := '"#p253781"'
cZoeksub1_end := '</a>'
ctempSub = textertussen( cText, cZoeksub1_start,cZoeksub1_end, 1 )
// Auther
cZoeksub1_start := 'coloured">'
cZoeksub1_end := '</a>'
ctempSub = textertussen( cText, cZoeksub1_start,cZoeksub1_end, 1 )
aadd(aData,"Author : "+cTempSub)
// Date
cZoeksub1_start := 'raquo;'
cZoeksub1_end := '</p>'
ctempSub = textertussen( cText, cZoeksub1_start,cZoeksub1_end, 1 )
aadd(aData,"Date : "+cTempSub)
// Content
cZoeksub1_start := '"content">'
cZoeksub1_end := '<dl class'
ctempSub = textertussen( cText, cZoeksub1_start,cZoeksub1_end, 1 )
aadd(aData,"Content : "+cTempSub)
// Source code
cZoeksub1_start := '00D7D7;">' // This color seems to be always there
cZoeksub1_end := '</code>'
ctempSub = textertussen( cText, cZoeksub1_start,cZoeksub1_end, 1 )
aadd(aData,"Source 1 : "+cTempSub)
// Trim the source from HTML code
ctempSub = strtran(ctempSub,"</span>","")
aadd(aData,"Source 2: "+cTempSub)
// Clean more HTML code that is more than once in de code
cZoeksub1_start := '<' // This color seems to be always there
cZoeksub1_end := '>'
do while .t.
nTel++
if nTel > 100 // In case of endless loop
exit
endif
if at("<",cTempSub) > 0 .and. at(">",cTempSub) > 0
cData = textertussen( ctempSub, cZoeksub1_start,cZoeksub1_end, 1 )
if !empty(cData)
ctempsub = strtran(ctempsub,cData,"")
ctempsub = strtran(ctempsub,"<>","")
endif
else
exit
endif
enddo
do while at("(",ctempsub) > 0
ctempsub = strtran(ctempsub,"(","(")
enddo
do while at(")",ctempsub) > 0
ctempsub = strtran(ctempsub,")",")")
enddo
cZoeksub1_start := '#'
cZoeksub1_end := ';'
do while .t.
nTel++
if nTel > 100 // In case of endless loop
exit
endif
if at("#",cTempSub) > 0 .and. at(";",cTempSub) > 0
cData = textertussen( ctempSub, cZoeksub1_start,cZoeksub1_end, 1 )
if !empty(cData)
ctempsub = strtran(ctempsub,cData,"")
ctempsub = strtran(ctempsub,"#;","")
endif
else
exit
endif
enddo
do while at(""",ctempsub) > 0
ctempsub = strtran(ctempsub,""","")
enddo
do while at(" ",ctempsub) > 0
ctempsub = strtran(ctempsub," ","")
enddo
do while at("&&",ctempsub) > 0
ctempsub = strtran(ctempsub,"&&","")
enddo
do while at("&&",ctempsub) > 0
ctempsub = strtran(ctempsub,"&&","")
enddo
aadd(aData,"Source 3 : "+CRLF+CRLF+cTempSub)
xbrowser(aData)
msginfo(cTempSub)
return nil
function Textertussen( cText, cStartTag, cCloseTag, nPos, cLeft, cRight )
local cRet := ""
if !( cStartTag $ cText )
cLeft := cText
cRight := ""
return ""
endif
cRight := AfterAtNum( cStartTag, cText, nPos )
cRet := BeforAtNum( cCloseTag, cRight, 1 )
if PCount() > 4
cLeft := BeforAtNum( cStartTag, cText, nPos )
cRight := AfterAtNum( cCloseTag, cRight, 1 )
endif
return cRet