Demo-ExtractRelative

From iMacros

Jump to: navigation, search

Preceding TAG commands may be used for relative positioning of the following TAG or extraction.

VERSION BUILD=6120525     
TAB T=1     
TAB CLOSEALLOTHERS     
URL GOTO=http://www.iopus.com/imacros/demo/v6/extract2/     
'
'Classic extraction will count the number of cells from the TOP of the page
'So the 1st cell of the table is the 8th cell on the page
TAG POS=26 TYPE=TD ATTR=TXT:* EXTRACT=TXT  
'
'Better to use positioning relative to the TAG command that
'appears just before the EXTRACT command
'
TAG POS=1 TYPE=DIV ATTR=TXT:MyTable
'Postion is now R3, the 3rd cell after the text "Mytable"   
TAG POS=R3 TYPE=TD ATTR=TXT:* EXTRACT=TXT
'The following line is relative to the TAG POS=R3 line => extracts "4"
TAG POS=R1 TYPE=TD ATTR=TXT:* EXTRACT=TXT
'The following line is relative to the TAG POS=R1 line => extracts "5"
TAG POS=R1 TYPE=TD ATTR=TXT:* EXTRACT=TXT