The renewal maintenance has officially ended for Progress iMacros effective November 30, 2023.
This Wiki site will also no longer be moderated from the Progress side.
Thank you again for your business and support.
Sincerely, The Progress Team
Difference between revisions of "V7 Relative positioning"
Line 1: | Line 1: | ||
− | + | In order to keep the iMacros V7 as much compatible with iMacros for Firefox, we had to change iMacros relative positioning algorithm. Therefore, it is no longer possible to tag an element relative to its outer element, in a nested situation. This is easier to understand with a simple example. The following macro | |
URL GOTO=http://www.iopus.com/imacros/demo/v6/extract2/ | URL GOTO=http://www.iopus.com/imacros/demo/v6/extract2/ |
Revision as of 10:04, 21 May 2010
In order to keep the iMacros V7 as much compatible with iMacros for Firefox, we had to change iMacros relative positioning algorithm. Therefore, it is no longer possible to tag an element relative to its outer element, in a nested situation. This is easier to understand with a simple example. The following macro
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
first tags the table cell TD and looks for the next occurrence of a link. While V6 extracts the link which is inside that table cell, namely "HREF extracts links", V7 and iMacros for Firefox extract the next link's text: "keyword detection with EXTRACT".
How to change your macros
Knowing that relative positioning is relative to the element's end, all you have to do is to change the anchor (reference) tag. For instance, the V6 macro
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
to extract the values in each table row, can be easily adapted to
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
Notice that both produce the same result, but while in the first version !LOOP has to run from 3 to 7, the new version needs !LOOP from 1 to 5, to get all the rows in the table.