Macro cannot find a #EANF# extract to stop on

Discussions and Tech Support related to automating the iMacros Browser or Internet Explorer from any scripting and programming language, such as VBS (WSH), VBA, VB, Perl, Delphi, C# or C++.
Forum rules
iMacros EOL - Attention!

The renewal maintenance has officially ended for Progress iMacros effective November 20, 2023 and all versions of iMacros are now considered EOL (End-of-Life). The iMacros products will no longer be supported by Progress (aside from customer license issues), and these forums will also no longer be moderated from the Progress side.

Thank you again for your business and support.

Sincerely,
The Progress Team

Before asking a question or reporting an issue:
1. Please review the list of FAQ's.
2. Use the search box (at the top of each forum page) to see if a similar problem or question has already been addressed.
3. Try searching the iMacros Wiki - it contains the complete iMacros reference as well as plenty of samples and tutorials.
4. We can respond much faster to your posts if you include the following information: CLICK HERE FOR IMPORTANT INFORMATION TO INCLUDE IN YOUR POST
Post Reply
sylviewp
Posts: 1
Joined: Tue Sep 24, 2013 5:11 am

Macro cannot find a #EANF# extract to stop on

Post by sylviewp » Tue Sep 24, 2013 5:30 am

Hiya,
I have looked in the iOpus forum for an answer these last few days but all I find is references to using the iimGetLastExtract which, on its own, will not work for me. I hope someone can help.
I am running a pretty basic vba script to scrape rows of data into a csv file.
Normally, the macro would terminate when it reaches the last page however, for this particular URL, it just won't work.
It seems that it is not finding an #EANF# to bail out on because it is continually scraping the last page that actually has some content on it.
It keep scraping the last entries over and over again with no end in sight :)
I guess I need to add a second variable to keep track of the imGetLastExtract from the previous page scrape. and then compare the current page against this new variable. If they are the same then I can probably guess it is the last page and close the script.

That sounds very easy on paper but am really not sure how to set up this new variable. Any suggestion is really appreciated. Thanks a lot. Sylvie


Sub iMacroHandlerB()
Dim iim1, iret, i
Dim Pageloop

'Start iMacro Browser
Set iim1 = CreateObject("imacros")
iret = iim1.iimInit("", False)

'Run the Initial Macro
iret = iim1.iimPlay("Loop_Initial")

i = 1
Do
i = i + 1
iret = iim1.iimset("Pageloop", i)
iret = iim1.iimPlay("Strip")
If (iim1.iimGetLastExtract()) = "#EANF#" Then
iret = iim1.iimExit()
End If
Loop
End Sub

Loop_Initial:

VERSION BUILD=6801021
TAB T=1
TAB CLOSEALLOTHERS
URL GOTO=https://www.insight.com/insightweb/sear ... s%20nas%22
SET !EXTRACT_TEST_POPUP NO
WAIT SECONDS=5

Strip:

VERSION BUILD=6801021
TAB T=1
TAB CLOSEALLOTHERS
SET !EXTRACT_TEST_POPUP NO
SET !ERRORIGNORE YES
TAG POS=1 TYPE=DIV ATTR=CLASS:productTitle&&TXT:*&&ID:prodTitle EXTRACT=TXT
TAG POS=1 TYPE=DIV ATTR=CLASS:productDescription&&TXT:* EXTRACT=TXT
SAVEAS TYPE=EXTRACT FOLDER=* FILE=INSIGHT_STREET_HP.TXT
TAG POS=2 TYPE=DIV ATTR=CLASS:productTitle&&TXT:*&&ID:prodTitle EXTRACT=TXT
TAG POS=2 TYPE=DIV ATTR=CLASS:productDescription&&TXT:* EXTRACT=TXT
SAVEAS TYPE=EXTRACT FOLDER=* FILE=INSIGHT_STREET_HP.TXT
TAG POS=3 TYPE=DIV ATTR=CLASS:productTitle&&TXT:*&&ID:prodTitle EXTRACT=TXT
TAG POS=3 TYPE=DIV ATTR=CLASS:productDescription&&TXT:* EXTRACT=TXT
SAVEAS TYPE=EXTRACT FOLDER=* FILE=INSIGHT_STREET_HP.TXT
TAG POS=4 TYPE=DIV ATTR=CLASS:productTitle&&TXT:*&&ID:prodTitle EXTRACT=TXT
TAG POS=4 TYPE=DIV ATTR=CLASS:productDescription&&TXT:* EXTRACT=TXT
SAVEAS TYPE=EXTRACT FOLDER=* FILE=INSIGHT_STREET_HP.TXT
TAG POS=5 TYPE=DIV ATTR=CLASS:productTitle&&TXT:*&&ID:prodTitle EXTRACT=TXT
TAG POS=5 TYPE=DIV ATTR=CLASS:productDescription&&TXT:* EXTRACT=TXT
SAVEAS TYPE=EXTRACT FOLDER=* FILE=INSIGHT_STREET_HP.TXT
TAG POS=6 TYPE=DIV ATTR=CLASS:productTitle&&TXT:*&&ID:prodTitle EXTRACT=TXT
TAG POS=6 TYPE=DIV ATTR=CLASS:productDescription&&TXT:* EXTRACT=TXT
SAVEAS TYPE=EXTRACT FOLDER=* FILE=INSIGHT_STREET_HP.TXT
TAG POS=7 TYPE=DIV ATTR=CLASS:productTitle&&TXT:*&&ID:prodTitle EXTRACT=TXT
TAG POS=7 TYPE=DIV ATTR=CLASS:productDescription&&TXT:* EXTRACT=TXT
SAVEAS TYPE=EXTRACT FOLDER=* FILE=INSIGHT_STREET_HP.TXT
TAG POS=8 TYPE=DIV ATTR=CLASS:productTitle&&TXT:*&&ID:prodTitle EXTRACT=TXT
TAG POS=8 TYPE=DIV ATTR=CLASS:productDescription&&TXT:* EXTRACT=TXT
SAVEAS TYPE=EXTRACT FOLDER=* FILE=INSIGHT_STREET_HP.TXT
TAG POS=9 TYPE=DIV ATTR=CLASS:productTitle&&TXT:*&&ID:prodTitle EXTRACT=TXT
TAG POS=9 TYPE=DIV ATTR=CLASS:productDescription&&TXT:* EXTRACT=TXT
SAVEAS TYPE=EXTRACT FOLDER=* FILE=INSIGHT_STREET_HP.TXT
TAG POS=10 TYPE=DIV ATTR=CLASS:productTitle&&TXT:*&&ID:prodTitle EXTRACT=TXT
TAG POS=10 TYPE=DIV ATTR=CLASS:productDescription&&TXT:* EXTRACT=TXT
SAVEAS TYPE=EXTRACT FOLDER=* FILE=INSIGHT_STREET_HP.TXT
TAG POS=1 TYPE=A ATTR=TXT:{{Pageloop}}
Post Reply