/   Site Map  /   About Us  /  General Products  /  MV Products  /  Outsourcing   / Home page   /

PixieWare Software Documentation

PixieRobot™- A Browser Script

 
 
Back to Browser 

VBSCRIPT TO SEARCH FOR AND EXTRACT "PRICE TABLE"

 

Sub Main
  ' Product price extract from  http://www.pixieware.com/totprices.htm
  ' This VB Script extracts the price table from the above HTML page. This 
  ' script searches the HTML for the Price data that is found between two 
  ' pre-selected HTML tags: <table> and </table>.

  ' The script statement Monitor=True causes the conversation to be 
  ' made visible. Monitor=True should always be the first line in a new 
  ' Sub Main. Change to Monitor=False when you "go production".
Monitor = True

  ' The script statement Silent=True causes "pup-up boxes" to be ignored. 
Silent = True

  ' Set up the address (URL) to navigate to. This is a PixieRobot function
  ' used for navigation and form submission. The HTML code is returned 
  ' as a string in the variable "s", from where it can be processed.
s = ExecuteWWW("http://www.pixieware.com/totprices.htm")

  ' Find the nominated string embedded in the source HTML of the URL.
  ' The InStr function returns the numeric position of the first occurrence 
  ' of a specified substring within a specified string when starting from 
  ' the beginning (left end) of the string. The string was chosen as it
  ' represents something unique on the Web page and therefor is a good
  ' place on which to focus the search and extract process.
iPos = Instr(1, s, "Prices are subject to change without notice.", 1)

  ' As there are several occurrences of <table> in the HTML but we need to find 
  ' the occurrence immediately following the "Prices are ...." string. 
iPos = Instr(iPos, s, "<table ", 1)

  ' The Mid function returns the portion of the designated string for a 
  ' designated length starting from the position (iPos) in the string. 
s = Mid(s, iPos)

  ' Now find the </table> string following the nominated <table> string.
iPos = Instr(1, s, "</table>", 1)

  ' The Left function returns the left portion of the designated string for 
  ' a designated length. iPos plus the length of </table> (8 characters).
s = Left(s, iPos+8)

  ' Now output the extracted string into the nominated file. The .xls 
  ' file extension will cause MS_Excel to read the extracted HTML and 
  ' format the table (into columns and rows) in the same manner as a browser. 
Call OutputToFile(s, "prices.xls")
End Sub

 

Return to PixieRobot Browsing

Email: sales@pixieware.com

/   Site Map  /   About Us  /  General Products  /  MV Products  /  Outsourcing   / Home page   /