This is easier to understand with a simple example. The following macro first tags the table cell TD and looks for the next occurrence of a link.
Code: Select all
URL GOTO=http://www.iopus.com/imacros/demo/v6/extract2/
TAG POS=1 TYPE=TD ATTR=CLASS:bdytxt&&TXT:HREF<SP>extracts<SP>links
TAG POS=R1 TYPE=A ATTR=TITLE:* EXTRACT=TXT
Knowing that relative positioning is relative to the element's end, all you have to do is change the anchor (reference) tag. For instance, the v6 macro for extracting the values in each table row:
Code: Select all
VERSION BUILD=6851105
TAB T=1
TAB CLOSEALLOTHERS
URL GOTO=http://www.x-rates.com/
'Anchor to the exchange rates table
TAG POS=2 TYPE=TABLE ATTR=TXT:<SP><SP><SP><SP>USD<SP><SP><SP><SP>GBP*
'Extract each of the rows *inside* the table
SET !LOOP 3
TAG POS=R{{!LOOP}} TYPE=TR ATTR=TXT:* EXTRACT=TXT
Code: Select all
VERSION BUILD=706710521
TAB T=1
TAB CLOSEALLOTHERS
URL GOTO=http://www.x-rates.com/
'Anchor to the header row
TAG POS=4 TYPE=TR ATTR=TXT:<SP><SP><SP><SP>USD<SP><SP><SP><SP>GBP*
'Extract each of the rows *below* the header
TAG POS=R{{!LOOP}} TYPE=TR ATTR=TXT:* EXTRACT=TXT
Alternatively, you can use XPATH to position the tag. iMacros 7 also supports XPath expressions in the TAG command, although not the id() function