CaptureTableHTML

Capture function, Web function.

The CaptureTableHTML function captures the text of the specified range of cells in an HTML table within a Web page.

Usage

Used for retrieving colums or lines of data from a Web page and insert them in an Excel file for instance. You can retrieve prices from ebay, retrieve job positions, capture phones from a yellow pages site, ... Capture wizard helps you for data extraction : menu Start/Capture wizard. And a step by step capture process is available at Web how to capture data.

Syntax

ret=CaptureTableHTML(<table_descriptor>,<range_descriptor>,tabcell$())

Parameters

<table_descriptor>, string, unique identifier for the HTML element TABLE from which the inner text of the <range_descriptor> is captured in tabcell$(). Spy can be used for generating automatically the <table_descriptor>. See HTML descriptor for a detailed explanation. Only HTML descriptors using CONTENT keyword are valid for the CaptureTableHTML function.

<range_descriptor>, string. It specifies the range of cells to capture, such as R4C2:R4C6 for a row or R2C2:R5C2 for a column.

<tabcell$>, array of strings. The array must be declared at the beginning of the script using Dim. The inner text of the cells specified in <range_descriptor> are written to tabcell$(), beginning with index 0. If the array is smaller than the range, only the number of cells which fit in the array are written.

Return value

Ret, numeric return code. When the capture is successful, the function returns the number of cells captured, otherwise use this return code for Error Handling. The return code is -1 if the capture could not be done or if the range is invalid.

Remarks

CaptureTableHTML does not include any synchronization; a UsePage must be used before to be sure that the object to capture is ready.

Use the Capture wizard (menu Start/Capture wizard) to generate the needed WinTask code for your extraction process.

See also

CaptureHTML

GetHTMLEditText

ExtractLink

Example

 

dim tabcell$(50)

StartBrowser("IE","www.wintask.com/faq.php")

UsePage("WinTask – FAQ")
ret=CaptureTableHTML("TABLE[CONTENT='Can']","R1C1:R15C1",tabcell$())
Msgbox(tabcell$(0))

CloseBrowser()