[HELP] Parsing multiple items
from
WinCustomize Forums
I'm working on a Yellow Pages widgets and have been able to get info from the website but now I'm having trouble getting multiple entries to display. I've tried looking at the newsfeed widget which helped me get this far but as the results aren't in XML i can't use the xmlstripper function.
Any help would be much appreciated. Thankyou.
Any help would be much appreciated. Thankyou.
Code
- Sub Object_OnScriptEnter
- Object.SetTimer 568,600000
- 'Clean widget for startup
- DesktopX.Object("widget_phonebook_name").Text = "---"
- DesktopX.Object("widget_phonebook_number").Text = ""
- DesktopX.Object("widget_phonebook_address").Text = ""
- DesktopX.Object("widget_phonebook_name2").Text = "---"
- DesktopX.Object("widget_phonebook_number2").Text = ""
- DesktopX.Object("widget_phonebook_address2").Text = ""
- DesktopX.Object("widget_phonebook_name3").Text = "---"
- DesktopX.Object("widget_phonebook_number3").Text = ""
- DesktopX.Object("widget_phonebook_address3").Text = ""
- DesktopX.Object("widget_phonebook_listingno").Text = "- of -"
- Object_OnTimer568
- End Sub
- Sub Object_OnTimer568
- If System.InternetConnected Then
- postcode = DesktopX.Object("widget_phonebook_postcode").Text
- businessname = DesktopX.ScriptObject("widget_phonebook_businessname").Control.Text
- Set http = CreateObject("Microsoft.XmlHttp")
- http.Open "GET", "http://www.yellowpages.com.au/search/postSearchEntry.do?businessType=&businessName=" & businessname & "&locationClue=" & postcode & "&serviceArea=true", False
- http.send ""
- phonedata = http.responseText
- phonedata = Replace(phonedata, Chr(34), "")
- phonedata = Replace(phonedata, "&", "&")
- phonedata = Replace(phonedata, "'", "'")
- htmlstring = ""
- '----
- 'Strips the searched business info from webpage
- If InStr(phonedata, "listingDets") > 0 Then
- phoneinfo = Mid(phonedata, InStr(phonedata, "listingNotes"), 1000)
- End If
- 'Calls business name
- If InStr(phonedata, "namefree") > 0 Then
- phonename = Mid(phoneinfo, InStr(phoneinfo, "namefree"),500)
- 'Gets length of searched business
- tempname = InStr(10, phonename, "<")
- namelen = Len(tempname)
- 'Sets business name
- phonename = Mid(phonename, 10, tempname - 10)
- If Len(phonename) > 15 Then
- phonename = Mid(phonename, 1, 15) & " ..."
- End If
- DesktopX.Object("widget_phonebook_name").Text = phonename
- End If
- '----
- 'Calls business number
- If InStr(phonedata, "ph:") > 0 Then
- phonenumber = Mid(phonedata, InStr(phonedata, "ph:"),50)
- 'Gets length of business number
- tempnumber = InStr(5, phonenumber, " ")
- numberlen = Len(tempnumber)
- 'Sets business number
- phonenumber = Mid(phonenumber, 5, tempnumber - 5)
- DesktopX.Object("widget_phonebook_number").Text = phonenumber
- End If
- '----
- 'Send business address
- If InStr(phonedata, "listingInfo") > 0 Then
- phoneaddress = Mid(phonedata, InStr(phonedata, "listingInfo"),100)
- 'Gets length of business address
- tempaddress = InStr(13, phoneaddress, "<")
- 'Sets business address
- phoneaddress = Mid(phoneaddress, 13, tempaddress - 13)
- DesktopX.Object("widget_phonebook_address").Text = phoneaddress
- End If
- 'Sends number of business listings
- If InStr(phonedata, "listingCount") > 0 Then
- phonecount = Mid(phonedata, InStr(phonedata, "listingCount"),100)
- 'Gets length of business address
- tempcount = InStr(14, phonecount, "<")
- 'Sets business address
- phonecount = Mid(phonecount, 14, tempcount - 14)
- DesktopX.Object("widget_phonebook_listingno").Text = phonecount
- End If
- End If
- End Sub
- 'Called when the script is terminated
- Sub Object_OnScriptExit
- End Sub