[HELP] Parsing multiple items

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.

Code
  1. Sub Object_OnScriptEnter
  2. Object.SetTimer 568,600000
  3. 'Clean widget for startup
  4. DesktopX.Object("widget_phonebook_name").Text = "---"
  5. DesktopX.Object("widget_phonebook_number").Text = ""
  6. DesktopX.Object("widget_phonebook_address").Text = ""
  7. DesktopX.Object("widget_phonebook_name2").Text = "---"
  8. DesktopX.Object("widget_phonebook_number2").Text = ""
  9. DesktopX.Object("widget_phonebook_address2").Text = ""
  10. DesktopX.Object("widget_phonebook_name3").Text = "---"
  11. DesktopX.Object("widget_phonebook_number3").Text = ""
  12. DesktopX.Object("widget_phonebook_address3").Text = ""
  13. DesktopX.Object("widget_phonebook_listingno").Text = "- of -"
  14. Object_OnTimer568
  15. End Sub
  16. Sub Object_OnTimer568
  17. If System.InternetConnected Then
  18. postcode = DesktopX.Object("widget_phonebook_postcode").Text
  19. businessname = DesktopX.ScriptObject("widget_phonebook_businessname").Control.Text
  20. Set http = CreateObject("Microsoft.XmlHttp")
  21. http.Open "GET", "http://www.yellowpages.com.au/search/postSearchEntry.do?businessType=&businessName=" & businessname & "&locationClue=" & postcode & "&serviceArea=true", False
  22. http.send ""
  23. phonedata = http.responseText
  24. phonedata = Replace(phonedata, Chr(34), "")
  25. phonedata = Replace(phonedata, "&", "&")
  26. phonedata = Replace(phonedata, "'", "'")
  27. htmlstring = ""
  28. '----
  29. 'Strips the searched business info from webpage
  30. If InStr(phonedata, "listingDets") > 0 Then
  31. phoneinfo = Mid(phonedata, InStr(phonedata, "listingNotes"), 1000)
  32. End If
  33. 'Calls business name
  34. If InStr(phonedata, "namefree") > 0 Then
  35. phonename = Mid(phoneinfo, InStr(phoneinfo, "namefree"),500)
  36. 'Gets length of searched business
  37. tempname = InStr(10, phonename, "<")
  38. namelen = Len(tempname)
  39. 'Sets business name
  40. phonename = Mid(phonename, 10, tempname - 10)
  41. If Len(phonename) > 15 Then
  42. phonename = Mid(phonename, 1, 15) & " ..."
  43. End If
  44. DesktopX.Object("widget_phonebook_name").Text = phonename
  45. End If
  46. '----
  47. 'Calls business number
  48. If InStr(phonedata, "ph:") > 0 Then
  49. phonenumber = Mid(phonedata, InStr(phonedata, "ph:"),50)
  50. 'Gets length of business number
  51. tempnumber = InStr(5, phonenumber, " ")
  52. numberlen = Len(tempnumber)
  53. 'Sets business number
  54. phonenumber = Mid(phonenumber, 5, tempnumber - 5)
  55. DesktopX.Object("widget_phonebook_number").Text = phonenumber
  56. End If
  57. '----
  58. 'Send business address
  59. If InStr(phonedata, "listingInfo") > 0 Then
  60. phoneaddress = Mid(phonedata, InStr(phonedata, "listingInfo"),100)
  61. 'Gets length of business address
  62. tempaddress = InStr(13, phoneaddress, "<")
  63. 'Sets business address
  64. phoneaddress = Mid(phoneaddress, 13, tempaddress - 13)
  65. DesktopX.Object("widget_phonebook_address").Text = phoneaddress
  66. End If
  67. 'Sends number of business listings
  68. If InStr(phonedata, "listingCount") > 0 Then
  69. phonecount = Mid(phonedata, InStr(phonedata, "listingCount"),100)
  70. 'Gets length of business address
  71. tempcount = InStr(14, phonecount, "<")
  72. 'Sets business address
  73. phonecount = Mid(phonecount, 14, tempcount - 14)
  74. DesktopX.Object("widget_phonebook_listingno").Text = phonecount
  75. End If
  76. End If
  77. End Sub
  78. 'Called when the script is terminated
  79. Sub Object_OnScriptExit
  80. End Sub
2,763 views 0 replies