Reputation: 1389
The following code logs into a Wordpress site and posts content (from Articles.csv) into two forms (title & post) and then submit the material and logs errors or sucess.
This is how my code looks:
Replaying #luikang.iim
1 VERSION BUILD=6050612 RECORDER=CR
2
3 TAB T=1
4
5 SET !DATASOURCE Articles.csv
6 SET !DATASOURCE_COLUMNS 2
7 SET !LOOP 2
8 SET !DATASOURCE_LINE {{!LOOP}}
9 SET !ERRORIGNORE YES
10 SET !TIMEOUT_PAGE 2
11
12 URL GOTO=http://luikang.se/wp-login.php
13 TAG POS=1 TYPE=INPUT:TEXT FORM=ID:loginform ATTR=ID:user_login CONTENT=Mother
14 SET !ENCRYPTION NO
15 TAG POS=1 TYPE=INPUT:PASSWORD FORM=ID:loginform ATTR=ID:user_pass CONTENT=dfd92dkfgUud
16 TAG POS=1 TYPE=INPUT:SUBMIT FORM=ID:loginform ATTR=ID:wp-submit
17 WAIT SECONDS=1
18 TAG POS=1 TYPE=INPUT:TEXT FORM=ID:articleSubmit ATTR=NAME:title CONTENT={{!COL1}}
19 WAIT SECONDS=2
20 TAG POS=1 TYPE=A ATTR=ID:post-html
21 WAIT SECONDS=1
22 TAG POS=1 TYPE=TEXTAREA FORM=ID:articleSubmit ATTR=ID:post CONTENT={{!COL2}}
23 WAIT SECONDS=1
24 TAG POS=1 TYPE=A ATTR=ID:post-tmce
25 WAIT SECONDS=1
26 TAG POS=1 TYPE=SELECT FORM=ID:articleSubmit ATTR=ID:cats[] CONTENT=%1
27 TAG POS=1 TYPE=INPUT:SUBMIT FORM=ID:articleSubmit ATTR=ID:submit
28
29 TAG POS=1 TYPE=DIV ATTR=CLASS:success EXTRACT=TXT
30 TAG POS=1 TYPE=DIV ATTR=CLASS:error EXTRACT=TXT
31 SAVEAS TYPE=EXTRACT FOLDER=* FILE=test1.csv
32
33 TAG POS=2 TYPE=A ATTR=TXT:Log<SP>out
This is how my .CSV looks:
First, Second
Hello my name is Lui Kang,"Can someone, please, tell me how to make Johnny Cage combos"
Everything works perfectly, but not my INPUT.
Running the code, iMacro posts the following
title: Hello my name is Lui Kang,"Can someone, please, tell me how to make Johnny Cage combos"
post: undefined
If I change SET !LOOP 2 to SET !LOOP 1, it post the following:
title: First
post: Second
I need iMacro to post a sentence with commas, without this happening.
Should look like this:
title: Hello my name is Lui Kang
post: Can someone, please, tell me how to make Johnny Cage combos
wiki.imacros.net/Form_Filling says the following: Note: Quotation marks are optional in most cases. They are only required if the value itself contains a comma, or a new line.
What am I doing wrong?
Best regards,
Liu Kang
Upvotes: 1
Views: 2432
Reputation: 1389
Solved this myself by opening the CSV file in Notepad++ instead of Excel, there were hidden quotation marks there. I removed them.
Upvotes: 2