!ENDOFPAGE

From iMacros
Revision as of 13:04, 20 July 2010 by Mf (Talk | contribs)

(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search

Uses the !TAGSOURCEINDEX variable to define the end of page for iMacros. A search for a TAG element does not go below this limit.

Value iMacros Browser IE Plug-in

 Integer value, e. g. from {{!TAGSOURCEINDEX}}

Set By

[ ] Internal

[X] SET

Internal means that the iMacros program itself sets the value of the variable during program run. SET means that the user can set this value via the SET command inside a macro.

Examples

Sample usage

Endofpage.png


Macro code snippet

 'First, define END of the data range
 TAG POS=1 TYPE=TD ATTR=TXT:Do.<SP>05.02.09  
 SET !ENDOFPAGE {{!TAGSOURCEINDEX}}
 
 'Extraction anchor
 TAG POS=1 TYPE=TD ATTR=TXT:Mi.<SP>04.02.09   
 
 'Extraction
 'We increase the myloop var until we hit "end of page"  
 TAG POS=R{{myloop}} TYPE=TD ATTR=CLASS:planline* EXTRACT=TXT

Why use endofpage? Without defining the end of page, iMacros would not know when the first table is ended and the new table (new day) starts as the number of entries per day changes.

Sample macro

VERSION BUILD=6600525     
TAB T=1     
TAB CLOSEALLOTHERS     
URL GOTO=http://www.iopus.com/imacros/demo/v6/extract2/     
'first extraction without !ENDOFPAGE set, does extract fine
TAG POS=1 TYPE=A ATTR=TXT:HREF<SP>extracts<SP>links EXTRACT=TXT
'get the "stopword's" TAGSOURCEINDEX
TAG POS=1 TYPE=STRONG ATTR=TXT:Account<SP>Executive   
SET !ENDOFPAGE {{!TAGSOURCEINDEX}}
'now run the extraction again: it will fail as the corresponding HTML element comes *after* the "stopword"
TAG POS=1 TYPE=A ATTR=TXT:HREF<SP>extracts<SP>links EXTRACT=TXT

Notes

  • In order to use !ENDOFPAGE again for the next table, one needs to reset it to a larger value before tagging the new !ENDOFPAGE
 SET !ENDOFPAGE 99999
 TAG POS=1 TYPE=TD ATTR=TXT:Fr.<SP>06.02.09
 SET !ENDOFPAGE {{!TAGSOURCEINDEX}}
  • If you want to use a button or a link as !ENDOFPAGE, you should tag it with TAG ... EXTRACT=TXT, to avoid following the link or "pushing" the button. In that case, do not forget to use SET !EXTRACT NULL, to clear the extract variable before the real extract.

See Also

!TAGSOURCEINDEX