Problem with how to pu a comment AND IF THEN

Discussions and Tech Support related to website data extraction, screen scraping and data mining using iMacros.
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
CHAIGNEAU
Posts: 11
Joined: Thu Jul 27, 2006 8:54 am

Problem with how to pu a comment AND IF THEN

Post by CHAIGNEAU » Sun Aug 06, 2006 5:48 pm

Hello,

I would like, if it's possible to :

A - put this expression in the column 1 : "Process", in the column 2 : "ABC"
B - Replace the IF expression by IF THEN in the script in order to not have "#EANF#" result

Some one can help me?

VERSMacro_1: (navigation to the page)
TAB T=1
TAB CLOSEALLOTHERS
SET !EXTRACT_TEST_POPUP NO
'SET !VAR1 Process
URL GOTO=http:// xxxxxxx/xxx/xxxx
SIZE X=1532 Y=909
FILEDELETE NAME=List.txt



Macro_2: (extraction and save)
'TAG POS={{myloop}} TYPE=TXT ATTR=TXT:{{VAR1}}*
EXTRACT POS={{myloop}} TYPE=TXT ATTR=<TD<SP>width=180<SP>bgColor=#84abd4>*
EXTRACT POS={{myloop}} TYPE=TXT ATTR=<TD<SP>width="63%">*
EXTRACT POS={{myloop}} TYPE=TXT ATTR=<TD<SP>class=text2<SP>noWrap>*
EXTRACT POS={{myloop}} TYPE=TXT ATTR=<TD<SP>align=middle<SP>width="15%">*
SAVEAS TYPE=EXTRACT FOLDER=* FILE=List.txt





SCRIPT:

MsgBox "This script ......"

set iim1= CreateObject ("InternetMacros.iim")

iret = iim1.iimInit("-silent")
iret = iim1.iimPlay("Macro_1")

For m = 1 to 60
'm = 1
'If iret > 0 Then
' iret = iim1.iimSet ("-var_VAR1", cstr (VAR1))
iret = iim1.iimSet ("-var_myloop", cstr (m))
iret = iim1.iimPlay ("Macro_2")
' m = m + 1
Next
'end if
'If iret < 0 Then
' MsgBox "Erreur!"
'end if

iret = iim1.iimExit()

MsgBox "OK"

WScript.Quit(0)
User avatar
Tech Support
Posts: 4948
Joined: Tue Sep 20, 2005 7:25 pm
Contact:

Post by Tech Support » Tue Aug 08, 2006 1:52 pm

Hi,

Without being able to review the website it is very difficult to understand what it is you are trying to achieve.

Could you raise a support ticket with the full details, or else provide a screenshot and/or example files that illustrate what you are trying to do.

Daniel Kerr
iOpus Support
CHAIGNEAU
Posts: 11
Joined: Thu Jul 27, 2006 8:54 am

Post by CHAIGNEAU » Tue Aug 08, 2006 9:45 pm

Hi,

Thanks for you reply.
You will find below more detail about my first question.
I have worked all day but i don't find the solution about two requests :
A - How save on a TXT field named Alternate, information from a CSV field : the name of the shop (Col 1 - 00_SHOP_Alternate.CSV) to (Col 1 - Alternate.txt).
B1 - I want to save the TRAKMADE of the product on the TXT field (Col 2 - Alternate.txt), so i must do an IF condition test : where n must change only when the trakemade change.
B2 - In order to have a loop with only the number of rows, is it possible to change the For n = 1 to 30 by an Do While? and how to do that ?

Best regards

STRUCTURE FROM DATA TO EXTRACT
===============================================
TRAKMADE 1
Article 1.1 Price 1.1
Article 1.2 Price 1.2
Article 1.3 Price 1.3
......
TRAKMADE 2
Article 2.1 Price 2.1
Article 2.2 Price 2.2
Article 2.3 Price 2.3
......
......

DATASOURCE (00_SHOP_Alternate.CSV) :
===============================================
Shop, Categorie, Links
Alternate.eu,Barbone,http://www.alternate.eu/html/shop/produ ... Socket+775&

Macro_1: (navigation to the page)
===============================================
VERSION BUILD=5100314
TAB T=1
TAB CLOSEALLOTHERS
SET !DATASOURCE 00_SHOP_Alternate.csv
SET !DATASOURCE_COLUMNS 3
SET !LOOP 2
SET !DATASOURCE_LINE {{!LOOP}}
SET !EXTRACT_TEST_POPUP NO
'SET !VAR1 {{!COL1}}
URL GOTO={{!COL3}}
SIZE X=1532 Y=909
FILEDELETE NAME=Alternate.txt

Macro_3: (extraction AND save)
===============================================
'SET !EXTRACT {{!VAR1}} <=QUESTION A
EXTRACT POS=1 TYPE=TXT ATTR=<H1>*
EXTRACT POS={{loop_1}} TYPE=TXT ATTR=<H2<SP>style="MARGIN-BOTTOM:<SP>5px">*
EXTRACT POS={{loop_1}} TYPE=TXT ATTR=<DIV<SP>class="p14<SP>bold<SP>fleft">*
EXTRACT POS={{loop_2}} TYPE=TXT ATTR=<DIV<SP>class=info>*
'
EXTRACT POS={{loop_2}} TYPE=TXT ATTR=<DIV<SP>class=price>*
SAVEAS TYPE=EXTRACT FOLDER=* FILE=Alternate.txt

SCRIPT:
===============================================
'Note: Extraction .......

MsgBox "This script ......."
set iim1= CreateObject ("InternetMacros.iim")
iret = iim1.iimInit ("-silent")
iret = iim1.iimPlay("Macro_1")

m = 1

For n = 1 to 30
'If ..... Then ]
' m = n ]<=QUESTION B
'End If ]
iret = iim1.iimSet ("-var_loop_1", cstr (m))
iret = iim1.iimSet ("-var_loop_2", cstr (n))
iret = iim1.iimPlay ("Macro_3")
Next

iret = iim1.iimExit()
MsgBox "Ok"
WScript.Quit(0)
User avatar
Tech Support
Posts: 4948
Joined: Tue Sep 20, 2005 7:25 pm
Contact:

Post by Tech Support » Thu Aug 10, 2006 10:54 am

Hi,

As far as I understand from your explanation, the flexibility in file manipulation that you require, looping until EOF (end of file) etc. can be obtained by using the MS Text Driver.

The example scripts 'file-2-web' and 'file-2-web-method2', demonstrate two methods for file manipulation. In the second the MS Text Driver is used, this allows the do until EOF structure to be used.

This would also allow you to more easily use values from the input file to control extracts in the Macro_3.

As for your If Then comparison, I am not clear how you are changing the value of m. Do you need nested loops to increment both values?

Daniel Kerr
iOpus Support
Post Reply