Problem to fill a form with same IDs and dynamic CONTENT

Discussions and Tech Support specific to the iMacros Firefox Add-on.
Forum rules
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
User avatar
percios
Posts: 7
Joined: Sun Sep 17, 2017 3:05 pm

Problem to fill a form with same IDs and dynamic CONTENT

Post by percios » Thu Sep 21, 2017 2:36 pm

Browser: Mozilla Firefox 55.0.3 (64 bit)
Microsoft Windows 10 Pro 64 bit
Imacros version:VERSION BUILD=9030808
________________________________________________________________________________________________-

I've this HTML

<<form id="container" action="/index.php?r=friz/answer&language=it" method="post"><input value="XXXXXXXXXXXXXXXXXXXxx==" name="_csrf" id="_csrf" type="hidden"><fieldset>
<header>
<h1><span class="containerid">19. </span>COME MI CHIAMO?</h1>
</header>
<div class="answerinput error required">
<input class="focusme" name="answer[]" autocomplete="off" type="text"> </div>
<div class="center hidden" id="correctAnswer">
<p class="correct"><span class="successcheck"></span></p>
</div>
<div class="center">
<input value="next question >" type="submit">
</div>
</fieldset></form>

I want obtain that: if this code contains the word "CHIAMO", then input the word "OK" (in the form) and press submit, else do nothing.

I tried with imacros, but I'm not good with javascript, anyone can help me? Thanks.
Last edited by percios on Fri Sep 22, 2017 2:00 pm, edited 2 times in total.
Browser: Mozilla Firefox 55.0.3 (64 bit)
Microsoft Windows 10 Pro 64 bit
Imacros version:VERSION BUILD=9030808
chivracq
Posts: 8980
Joined: Sat Apr 13, 2013 1:07 pm
Location: Amsterdam (NL)

Re: javascript on imacros help

Post by chivracq » Thu Sep 21, 2017 5:12 pm

percios wrote:

Code: Select all

Browser: Mozilla Firefox 55.0.3 (64 bit)
Imacros version:VERSION BUILD=9030808 
________________________________________________________________________________________________-

I've this HTML

Code: Select all

<<form id="container" action="/index.php?r=friz/answer&language=it" method="post"><input value="XXXXXXXXXXXXXXXXXXXxx==" name="_csrf" id="_csrf" type="hidden"><fieldset>
	<header>
		<h1><span class="containerid">19. </span>COME MI CHIAMO?</h1>
	</header>
	<div class="answerinput error required">
		<input class="focusme" name="answer[]" autocomplete="off" type="text">	</div>
	<div class="center hidden" id="correctAnswer">
		<p class="correct"><span class="successcheck"></span></p>
	</div>
	<div class="center">
	<input value="next question >" type="submit">
</div>	
</fieldset></form>
I want obtain that: if this code contains the word "CHIAMO", then input the word "OK" (in the form) and press submit, else do nothing.

I tried with imacros, but I'm not good with javascript, anyone can help me? Thanks.
Oh!, good, FCI mentioned in this Thread, even if OS is missing, you should mention it as well in your 1st Thread, then I might reply... :idea:

For your Qt, you don't need any JavaScript, simply use Relative Positioning... :idea:
- (F)CI(M) = (Full) Config Info (Missing): iMacros + Browser + OS (+ all 3 Versions + 'Free'/'PE').
- I don't even read the Qt if that (required) Info is not mentioned...!
- Script & URL help a lot for more "educated" Help...
User avatar
percios
Posts: 7
Joined: Sun Sep 17, 2017 3:05 pm

Re: javascript on imacros help

Post by percios » Thu Sep 21, 2017 6:41 pm

Oh, sorry! I use Microsoft Windows 10 Pro 64 bit
Browser: Mozilla Firefox 55.0.3 (64 bit)
Microsoft Windows 10 Pro 64 bit
Imacros version:VERSION BUILD=9030808
chivracq
Posts: 8980
Joined: Sat Apr 13, 2013 1:07 pm
Location: Amsterdam (NL)

Re: javascript on imacros help

Post by chivracq » Fri Sep 22, 2017 1:17 am

percios wrote:Oh, sorry! I use Microsoft Windows 10 Pro 64 bit
OK, good, quick Learner..! :D

=> FCI:

Code: Select all

iMacros for FF v9.0.3, FF v55.0.3, Win10-Pro_x64.
OK, perfect, but hum, still missing in your previous Thread..., grrr...
(Second time I'm asking, I normally only help Users using the Forum "a bit correctly", I only reacted to this 2nd Thread of yours because the "Quality" already improved a lot, compared to the 1st one...), and that means for all their Threads:
FCI mentioned + correct Follow-up + trying their best and really getting stuck..., ah-ah...!

Hum, and "Descriptive Thread Title" (in the correct Sub-Forum of course), I realize only now that your Thread Title is a bit "useless", as maybe 70% of all Threads in the FF Sub-Forum are about "JavaScript" (which is the only Descriptive Term, as of course 100% of all Threads on the Forum are about 'iMacros" + "Help", tja...!), hum, not very helpful to search the Forum then I would think...!?

>>>

But OK, anyway, did you understand the "Path"/Solution I meant with "Relative Positioning"...?
=> Post your final Script then, to make this Thread a bit useful for other Users as well, even if the Thread Title is not very "appealing" (because way too vague) for other Users to check its Content, ah-ah...! :wink:
- (F)CI(M) = (Full) Config Info (Missing): iMacros + Browser + OS (+ all 3 Versions + 'Free'/'PE').
- I don't even read the Qt if that (required) Info is not mentioned...!
- Script & URL help a lot for more "educated" Help...
techimac
Posts: 309
Joined: Fri Feb 20, 2015 9:27 pm

Re: javascript on imacros help

Post by techimac » Fri Sep 22, 2017 6:41 am

Code: Select all

SET !ERRORIGNORE NO
SET !TIMEOUT_PAGE 1
TAG POS=1 TYPE=H1 ATTR=TXT:*CHIAMO*
TAG POS=1 TYPE=INPUT:TEXT FORM=ID:container ATTR=NAME:answer[] CONTENT=OK
SET !TIMEOUT_PAGE 20
TAG POS=1 TYPE=INPUT:SUBMIT FORM=ID:container ATTR=*
if you have more things to do in same script then this logic won't work
User avatar
percios
Posts: 7
Joined: Sun Sep 17, 2017 3:05 pm

Re: javascript on imacros help

Post by percios » Fri Sep 22, 2017 1:16 pm

techimac wrote:

Code: Select all

SET !ERRORIGNORE NO
SET !TIMEOUT_PAGE 1
TAG POS=1 TYPE=H1 ATTR=TXT:*CHIAMO*
TAG POS=1 TYPE=INPUT:TEXT FORM=ID:container ATTR=NAME:answer[] CONTENT=OK
SET !TIMEOUT_PAGE 20
TAG POS=1 TYPE=INPUT:SUBMIT FORM=ID:container ATTR=*
if you have more things to do in same script then this logic won't work
Exact, the code is ok, but the problem is that there are different forms like this and each time (it is a questionnaire), even if the answers to be compiled are the same, the order of question is always different, this code don't work because change the order of the questions and therefore of the answers.
Example: if i reg the macro I get this:
[...]
TAG POS=1 TYPE=INPUT:TEXT FORM=ID:container ATTR=NAME:answer[] CONTENT=Blue
TAG POS=1 TYPE=INPUT:SUBMIT FORM=ID:container ATTR=*
TAG POS=1 TYPE=INPUT:TEXT FORM=ID:container ATTR=NAME:answer[] CONTENT=Red
TAG POS=1 TYPE=INPUT:SUBMIT FORM=ID:container ATTR=*
TAG POS=1 TYPE=INPUT:TEXT FORM=ID:container ATTR=NAME:answer[] CONTENT=Green
TAG POS=1 TYPE=INPUT:SUBMIT FORM=ID:container ATTR=*
TAG POS=1 TYPE=INPUT:TEXT FORM=ID:container ATTR=NAME:answer[] CONTENT=Yellow
TAG POS=1 TYPE=INPUT:SUBMIT FORM=ID:container ATTR=*
[...]

If I retry, the next time iI'll get this:

[...]
TAG POS=1 TYPE=INPUT:TEXT FORM=ID:container ATTR=NAME:answer[] CONTENT=Red
TAG POS=1 TYPE=INPUT:SUBMIT FORM=ID:container ATTR=*
TAG POS=1 TYPE=INPUT:TEXT FORM=ID:container ATTR=NAME:answer[] CONTENT=Yellow
TAG POS=1 TYPE=INPUT:SUBMIT FORM=ID:container ATTR=*
TAG POS=1 TYPE=INPUT:TEXT FORM=ID:container ATTR=NAME:answer[] CONTENT=Blue
TAG POS=1 TYPE=INPUT:SUBMIT FORM=ID:container ATTR=*
TAG POS=1 TYPE=INPUT:TEXT FORM=ID:container ATTR=NAME:answer[] CONTENT=Green
TAG POS=1 TYPE=INPUT:SUBMIT FORM=ID:container ATTR=*
[...]

How do I distinguish between questions and answers?

Sorry for my english but it's not my native language.
Browser: Mozilla Firefox 55.0.3 (64 bit)
Microsoft Windows 10 Pro 64 bit
Imacros version:VERSION BUILD=9030808
User avatar
percios
Posts: 7
Joined: Sun Sep 17, 2017 3:05 pm

Re: javascript on imacros help

Post by percios » Fri Sep 22, 2017 1:22 pm

chivracq wrote:
percios wrote:Oh, sorry! I use Microsoft Windows 10 Pro 64 bit
OK, good, quick Learner..! :D

=> FCI:

Code: Select all

iMacros for FF v9.0.3, FF v55.0.3, Win10-Pro_x64.
OK, perfect, but hum, still missing in your previous Thread..., grrr...
(Second time I'm asking, I normally only help Users using the Forum "a bit correctly", I only reacted to this 2nd Thread of yours because the "Quality" already improved a lot, compared to the 1st one...), and that means for all their Threads:
FCI mentioned + correct Follow-up + trying their best and really getting stuck..., ah-ah...!

Hum, and "Descriptive Thread Title" (in the correct Sub-Forum of course), I realize only now that your Thread Title is a bit "useless", as maybe 70% of all Threads in the FF Sub-Forum are about "JavaScript" (which is the only Descriptive Term, as of course 100% of all Threads on the Forum are about 'iMacros" + "Help", tja...!), hum, not very helpful to search the Forum then I would think...!?

>>>

But OK, anyway, did you understand the "Path"/Solution I meant with "Relative Positioning"...?
=> Post your final Script then, to make this Thread a bit useful for other Users as well, even if the Thread Title is not very "appealing" (because way too vague) for other Users to check its Content, ah-ah...! :wink:

Ok, sorry for all, I don't speak well english and I use google translate to help me :D

I deleted the previous post because i'm using this.

I don't understand the "Path" solution :(

I'll try to change in better the title.
Browser: Mozilla Firefox 55.0.3 (64 bit)
Microsoft Windows 10 Pro 64 bit
Imacros version:VERSION BUILD=9030808
techimac
Posts: 309
Joined: Fri Feb 20, 2015 9:27 pm

Re: Problem to fill a form with same IDs and dynamic CONTENT

Post by techimac » Fri Sep 22, 2017 4:22 pm

send form url
chivracq
Posts: 8980
Joined: Sat Apr 13, 2013 1:07 pm
Location: Amsterdam (NL)

Re: javascript on imacros help

Post by chivracq » Fri Sep 22, 2017 4:22 pm

percios wrote:
techimac wrote:

Code: Select all

SET !ERRORIGNORE NO
SET !TIMEOUT_PAGE 1
TAG POS=1 TYPE=H1 ATTR=TXT:*CHIAMO*
TAG POS=1 TYPE=INPUT:TEXT FORM=ID:container ATTR=NAME:answer[] CONTENT=OK
SET !TIMEOUT_PAGE 20
TAG POS=1 TYPE=INPUT:SUBMIT FORM=ID:container ATTR=*
if you have more things to do in same script then this logic won't work
Exact, the code is ok, but the problem is that there are different forms like this and each time (it is a questionnaire), even if the answers to be compiled are the same, the order of question is always different, this code don't work because change the order of the questions and therefore of the answers.
Example: if i reg the macro I get this:

Code: Select all

[...]
TAG POS=1 TYPE=INPUT:TEXT FORM=ID:container ATTR=NAME:answer[] CONTENT=Blue
TAG POS=1 TYPE=INPUT:SUBMIT FORM=ID:container ATTR=*
TAG POS=1 TYPE=INPUT:TEXT FORM=ID:container ATTR=NAME:answer[] CONTENT=Red
TAG POS=1 TYPE=INPUT:SUBMIT FORM=ID:container ATTR=*
TAG POS=1 TYPE=INPUT:TEXT FORM=ID:container ATTR=NAME:answer[] CONTENT=Green
TAG POS=1 TYPE=INPUT:SUBMIT FORM=ID:container ATTR=*
TAG POS=1 TYPE=INPUT:TEXT FORM=ID:container ATTR=NAME:answer[] CONTENT=Yellow
TAG POS=1 TYPE=INPUT:SUBMIT FORM=ID:container ATTR=*
[...]
If I retry, the next time iI'll get this:

Code: Select all

[...]
TAG POS=1 TYPE=INPUT:TEXT FORM=ID:container ATTR=NAME:answer[] CONTENT=Red
TAG POS=1 TYPE=INPUT:SUBMIT FORM=ID:container ATTR=*
TAG POS=1 TYPE=INPUT:TEXT FORM=ID:container ATTR=NAME:answer[] CONTENT=Yellow
TAG POS=1 TYPE=INPUT:SUBMIT FORM=ID:container ATTR=*
TAG POS=1 TYPE=INPUT:TEXT FORM=ID:container ATTR=NAME:answer[] CONTENT=Blue
TAG POS=1 TYPE=INPUT:SUBMIT FORM=ID:container ATTR=*
TAG POS=1 TYPE=INPUT:TEXT FORM=ID:container ATTR=NAME:answer[] CONTENT=Green
TAG POS=1 TYPE=INPUT:SUBMIT FORM=ID:container ATTR=*
[...]
How do I distinguish between questions and answers?

Sorry for my english but it's not my native language.
Yep, normal, that's why I mentioned using Relative Positioning for the "Conditional Logic"... as this is probably the simplest way to go... :idea:
percios wrote:Ok, sorry for all, I don't speak well english and I use google translate to help me :D

I deleted the previous post because i'm using this.

I don't understand the "Path" solution :(

I'll try to change in better the title.
Yeah you don't need Google Translate to understand to mention your FCI...
And hum, deleting a Thread is not exactly "using the Forum correctly", but OK never mind, I see now how the 2 Threads are indeed related...

You don't understand the "Path"/Solution, well, then simply check the Documentation or search the Forum for Examples about "Relative Positioning"... But OK, you found Advanced User @techimac ready to write your Script and to help you, then I guess you are in "good hands", ah-ah...! :wink:
(I don't write Scripts for other Users, I let you find the Solution by yourself, which is more "Educative" I think, but other (Advanced) Users prefer to write your Script directly, OK, fair enough, but then I'm out... Good luck...)
- (F)CI(M) = (Full) Config Info (Missing): iMacros + Browser + OS (+ all 3 Versions + 'Free'/'PE').
- I don't even read the Qt if that (required) Info is not mentioned...!
- Script & URL help a lot for more "educated" Help...
techimac
Posts: 309
Joined: Fri Feb 20, 2015 9:27 pm

Re: Problem to fill a form with same IDs and dynamic CONTENT

Post by techimac » Fri Sep 22, 2017 4:30 pm

Click question and then use relative positioning TAG command like this

TAG POS=R1 TYPE=INPUT:TEXT FORM=ID:container ATTR=NAME:answer[] CONTENT=<ANSWER>
TAG POS=1 TYPE=INPUT:SUBMIT FORM=ID:container ATTR=*

TAG POS=R1
User avatar
percios
Posts: 7
Joined: Sun Sep 17, 2017 3:05 pm

Re: Problem to fill a form with same IDs and dynamic CONTENT

Post by percios » Fri Sep 22, 2017 4:46 pm

techimac wrote:send form url
Sure! https://www.onlinequizcreator.com/index ... anguage=it

This is my macro:

Code: Select all

VERSION BUILD=9030808 RECORDER=FX
TAB T=1
URL GOTO=https://www.onlinequizcreator.com/index.php?r=quiz/quiz&language=it
TAG POS=1 TYPE=INPUT:TEXT FORM=ID:questioncontainer ATTR=NAME:answer[] CONTENT=Green
TAG POS=1 TYPE=INPUT:SUBMIT FORM=ID:questioncontainer ATTR=*
TAG POS=1 TYPE=INPUT:TEXT FORM=ID:questioncontainer ATTR=NAME:answer[] CONTENT=Violet
TAG POS=1 TYPE=INPUT:SUBMIT FORM=ID:questioncontainer ATTR=*
TAG POS=1 TYPE=INPUT:TEXT FORM=ID:questioncontainer ATTR=NAME:answer[] CONTENT=Blue
TAG POS=1 TYPE=INPUT:SUBMIT FORM=ID:questioncontainer ATTR=*
TAG POS=1 TYPE=INPUT:TEXT FORM=ID:questioncontainer ATTR=NAME:answer[] CONTENT=Yellow
TAG POS=1 TYPE=INPUT:SUBMIT FORM=ID:questioncontainer ATTR=*
TAG POS=1 TYPE=INPUT:TEXT FORM=ID:questioncontainer ATTR=NAME:answer[] CONTENT=Red
TAG POS=1 TYPE=INPUT:SUBMIT FORM=ID:questioncontainer ATTR=*
Macro doesn't work because the order questions is always different.

P.S.
Q&A
Fanfoni=Blue
Nansoni=Red
Tandani=Green
Pataroti=Yellow
Preteresi=Violet
Browser: Mozilla Firefox 55.0.3 (64 bit)
Microsoft Windows 10 Pro 64 bit
Imacros version:VERSION BUILD=9030808
User avatar
percios
Posts: 7
Joined: Sun Sep 17, 2017 3:05 pm

Re: Problem to fill a form with same IDs and dynamic CONTENT

Post by percios » Fri Sep 22, 2017 5:29 pm

techimac wrote:Click question and then use relative positioning TAG command like this

TAG POS=R1 TYPE=INPUT:TEXT FORM=ID:container ATTR=NAME:answer[] CONTENT=<ANSWER>
TAG POS=1 TYPE=INPUT:SUBMIT FORM=ID:container ATTR=*

TAG POS=R1
I registering new macro, clicked on the title of question , changing TAG POS=R1 only in the rows like this (TAG POS=R1 TYPE=INPUT:TEXT FORM=ID:container ATTR=NAME:answer[] CONTENT=<ANSWER>) but does not work, not respect the casua order.

Code: Select all

VERSION BUILD=9030808 RECORDER=FX
SET !ERRORIGNORE YES
SET !REPLAYSPEED FAST
SET !TIMEOUT_STEP 4

TAG POS=1 TYPE=H1 ATTR=TXT:1.<SP>Come<SP>si<SP>chiamano<SP>i<SP>Fanfoni
TAG POS=R1 TYPE=INPUT:TEXT FORM=ID:questioncontainer ATTR=NAME:answer[] CONTENT=Blue
TAG POS=1 TYPE=INPUT:SUBMIT FORM=ID:questioncontainer ATTR=*
TAG POS=1 TYPE=H1 ATTR=TXT:2.<SP>Come<SP>si<SP>chiamano<SP>i<SP>Patarioti?
TAG POS=R1 TYPE=INPUT:TEXT FORM=ID:questioncontainer ATTR=NAME:answer[] CONTENT=Yellow
TAG POS=1 TYPE=INPUT:SUBMIT FORM=ID:questioncontainer ATTR=*
TAG POS=1 TYPE=H1 ATTR=TXT:3.<SP>Come<SP>si<SP>chiamano<SP>i<SP>Nansoni?
TAG POS=R1 TYPE=INPUT:TEXT FORM=ID:questioncontainer ATTR=NAME:answer[] CONTENT=Red
TAG POS=1 TYPE=INPUT:SUBMIT FORM=ID:questioncontainer ATTR=*
TAG POS=1 TYPE=H1 ATTR=TXT:4.<SP>Come<SP>si<SP>chiamano<SP>i<SP>Tandani?
TAG POS=R1 TYPE=INPUT:TEXT FORM=ID:questioncontainer ATTR=NAME:answer[] CONTENT=Green
TAG POS=1 TYPE=INPUT:SUBMIT FORM=ID:questioncontainer ATTR=*
TAG POS=1 TYPE=H1 ATTR=TXT:5.<SP>Come<SP>si<SP>chiamano<SP>i<SP>Preteresi?
TAG POS=R1 TYPE=INPUT:TEXT FORM=ID:questioncontainer ATTR=NAME:answer[] CONTENT=Violet
TAG POS=1 TYPE=INPUT:SUBMIT FORM=ID:questioncontainer ATTR=*
Browser: Mozilla Firefox 55.0.3 (64 bit)
Microsoft Windows 10 Pro 64 bit
Imacros version:VERSION BUILD=9030808
techimac
Posts: 309
Joined: Fri Feb 20, 2015 9:27 pm

Re: Problem to fill a form with same IDs and dynamic CONTENT

Post by techimac » Fri Sep 22, 2017 5:53 pm

Manually open URL and wait for question to appear
then run this script in loop of 5

Code: Select all

SET !TIMEOUT_PAGE 1
SET !ERRORIGNORE YES

TAG POS=1 TYPE=H1 ATTR=TXT:*Come<SP>si<SP>chiamano<SP>i<SP>Fanfoni
TAG POS=R1 TYPE=INPUT:TEXT FORM=ID:questioncontainer ATTR=NAME:answer[] CONTENT=Blue
TAG POS=1 TYPE=INPUT:SUBMIT FORM=ID:questioncontainer ATTR=*
TAG POS=1 TYPE=H1 ATTR=TXT:*Come<SP>si<SP>chiamano<SP>i<SP>Patarioti?
TAG POS=R1 TYPE=INPUT:TEXT FORM=ID:questioncontainer ATTR=NAME:answer[] CONTENT=Yellow
TAG POS=1 TYPE=INPUT:SUBMIT FORM=ID:questioncontainer ATTR=*
TAG POS=1 TYPE=H1 ATTR=TXT:*Come<SP>si<SP>chiamano<SP>i<SP>Nansoni?
TAG POS=R1 TYPE=INPUT:TEXT FORM=ID:questioncontainer ATTR=NAME:answer[] CONTENT=Red
TAG POS=1 TYPE=INPUT:SUBMIT FORM=ID:questioncontainer ATTR=*
TAG POS=1 TYPE=H1 ATTR=TXT:*Come<SP>si<SP>chiamano<SP>i<SP>Tandani?
TAG POS=R1 TYPE=INPUT:TEXT FORM=ID:questioncontainer ATTR=NAME:answer[] CONTENT=Green
TAG POS=1 TYPE=INPUT:SUBMIT FORM=ID:questioncontainer ATTR=*
TAG POS=1 TYPE=H1 ATTR=TXT:*Come<SP>si<SP>chiamano<SP>i<SP>Preteresi?
TAG POS=R1 TYPE=INPUT:TEXT FORM=ID:questioncontainer ATTR=NAME:answer[] CONTENT=Violet
TAG POS=1 TYPE=INPUT:SUBMIT FORM=ID:questioncontainer ATTR=*
WAIT SECONDS=5
chivracq
Posts: 8980
Joined: Sat Apr 13, 2013 1:07 pm
Location: Amsterdam (NL)

Re: Problem to fill a form with same IDs and dynamic CONTENT

Post by chivracq » Sat Sep 23, 2017 5:01 am

Oh...!, very good Ladies..!!!, I finally see some Relative Positioning in the Posts, eh-eh, finally...!!!!, ah-ah...!!
(Me solving a Thread = 1 or 2 Replies normally..., if FCI mentioned of course...!)
(But euh if @techimach answering, yep always interesting, usually takes 2 pages, ah-ah...! )
=> I'll just be following the Thread, enjoy yourself, ah-ah...!
techimac wrote:Click question and then use relative positioning TAG command like this

TAG POS=R1 TYPE=INPUT:TEXT FORM=ID:container ATTR=NAME:answer[] CONTENT=<ANSWER>
TAG POS=1 TYPE=INPUT:SUBMIT FORM=ID:container ATTR=*

TAG POS=R1
techimac wrote:Manually open URL and wait for question to appear
then run this script in loop of 5

Code: Select all

SET !TIMEOUT_PAGE 1
SET !ERRORIGNORE YES

TAG POS=1 TYPE=H1 ATTR=TXT:*Come<SP>si<SP>chiamano<SP>i<SP>Fanfoni
TAG POS=R1 TYPE=INPUT:TEXT FORM=ID:questioncontainer ATTR=NAME:answer[] CONTENT=Blue
TAG POS=1 TYPE=INPUT:SUBMIT FORM=ID:questioncontainer ATTR=*
TAG POS=1 TYPE=H1 ATTR=TXT:*Come<SP>si<SP>chiamano<SP>i<SP>Patarioti?
TAG POS=R1 TYPE=INPUT:TEXT FORM=ID:questioncontainer ATTR=NAME:answer[] CONTENT=Yellow
TAG POS=1 TYPE=INPUT:SUBMIT FORM=ID:questioncontainer ATTR=*
TAG POS=1 TYPE=H1 ATTR=TXT:*Come<SP>si<SP>chiamano<SP>i<SP>Nansoni?
TAG POS=R1 TYPE=INPUT:TEXT FORM=ID:questioncontainer ATTR=NAME:answer[] CONTENT=Red
TAG POS=1 TYPE=INPUT:SUBMIT FORM=ID:questioncontainer ATTR=*
TAG POS=1 TYPE=H1 ATTR=TXT:*Come<SP>si<SP>chiamano<SP>i<SP>Tandani?
TAG POS=R1 TYPE=INPUT:TEXT FORM=ID:questioncontainer ATTR=NAME:answer[] CONTENT=Green
TAG POS=1 TYPE=INPUT:SUBMIT FORM=ID:questioncontainer ATTR=*
TAG POS=1 TYPE=H1 ATTR=TXT:*Come<SP>si<SP>chiamano<SP>i<SP>Preteresi?
TAG POS=R1 TYPE=INPUT:TEXT FORM=ID:questioncontainer ATTR=NAME:answer[] CONTENT=Violet
TAG POS=1 TYPE=INPUT:SUBMIT FORM=ID:questioncontainer ATTR=*
WAIT SECONDS=5
techimac wrote:Manually open URL and wait for question to appear
then run this script in loop of 5

Code: Select all

SET !TIMEOUT_PAGE 1
SET !ERRORIGNORE YES

TAG POS=1 TYPE=H1 ATTR=TXT:*Come<SP>si<SP>chiamano<SP>i<SP>Fanfoni
TAG POS=R1 TYPE=INPUT:TEXT FORM=ID:questioncontainer ATTR=NAME:answer[] CONTENT=Blue
TAG POS=1 TYPE=INPUT:SUBMIT FORM=ID:questioncontainer ATTR=*
TAG POS=1 TYPE=H1 ATTR=TXT:*Come<SP>si<SP>chiamano<SP>i<SP>Patarioti?
TAG POS=R1 TYPE=INPUT:TEXT FORM=ID:questioncontainer ATTR=NAME:answer[] CONTENT=Yellow
TAG POS=1 TYPE=INPUT:SUBMIT FORM=ID:questioncontainer ATTR=*
TAG POS=1 TYPE=H1 ATTR=TXT:*Come<SP>si<SP>chiamano<SP>i<SP>Nansoni?
TAG POS=R1 TYPE=INPUT:TEXT FORM=ID:questioncontainer ATTR=NAME:answer[] CONTENT=Red
TAG POS=1 TYPE=INPUT:SUBMIT FORM=ID:questioncontainer ATTR=*
TAG POS=1 TYPE=H1 ATTR=TXT:*Come<SP>si<SP>chiamano<SP>i<SP>Tandani?
TAG POS=R1 TYPE=INPUT:TEXT FORM=ID:questioncontainer ATTR=NAME:answer[] CONTENT=Green
TAG POS=1 TYPE=INPUT:SUBMIT FORM=ID:questioncontainer ATTR=*
TAG POS=1 TYPE=H1 ATTR=TXT:*Come<SP>si<SP>chiamano<SP>i<SP>Preteresi?
TAG POS=R1 TYPE=INPUT:TEXT FORM=ID:questioncontainer ATTR=NAME:answer[] CONTENT=Violet
TAG POS=1 TYPE=INPUT:SUBMIT FORM=ID:questioncontainer ATTR=*
WAIT SECONDS=5
techimac wrote:Manually open URL and wait for question to appear
then run this script in loop of 5

Code: Select all

SET !TIMEOUT_PAGE 1
SET !ERRORIGNORE YES

TAG POS=1 TYPE=H1 ATTR=TXT:*Come<SP>si<SP>chiamano<SP>i<SP>Fanfoni
TAG POS=R1 TYPE=INPUT:TEXT FORM=ID:questioncontainer ATTR=NAME:answer[] CONTENT=Blue
TAG POS=1 TYPE=INPUT:SUBMIT FORM=ID:questioncontainer ATTR=*
TAG POS=1 TYPE=H1 ATTR=TXT:*Come<SP>si<SP>chiamano<SP>i<SP>Patarioti?
TAG POS=R1 TYPE=INPUT:TEXT FORM=ID:questioncontainer ATTR=NAME:answer[] CONTENT=Yellow
TAG POS=1 TYPE=INPUT:SUBMIT FORM=ID:questioncontainer ATTR=*
TAG POS=1 TYPE=H1 ATTR=TXT:*Come<SP>si<SP>chiamano<SP>i<SP>Nansoni?
TAG POS=R1 TYPE=INPUT:TEXT FORM=ID:questioncontainer ATTR=NAME:answer[] CONTENT=Red
TAG POS=1 TYPE=INPUT:SUBMIT FORM=ID:questioncontainer ATTR=*
TAG POS=1 TYPE=H1 ATTR=TXT:*Come<SP>si<SP>chiamano<SP>i<SP>Tandani?
TAG POS=R1 TYPE=INPUT:TEXT FORM=ID:questioncontainer ATTR=NAME:answer[] CONTENT=Green
TAG POS=1 TYPE=INPUT:SUBMIT FORM=ID:questioncontainer ATTR=*
TAG POS=1 TYPE=H1 ATTR=TXT:*Come<SP>si<SP>chiamano<SP>i<SP>Preteresi?
TAG POS=R1 TYPE=INPUT:TEXT FORM=ID:questioncontainer ATTR=NAME:answer[] CONTENT=Violet
TAG POS=1 TYPE=INPUT:SUBMIT FORM=ID:questioncontainer ATTR=*
WAIT SECONDS=5
- (F)CI(M) = (Full) Config Info (Missing): iMacros + Browser + OS (+ all 3 Versions + 'Free'/'PE').
- I don't even read the Qt if that (required) Info is not mentioned...!
- Script & URL help a lot for more "educated" Help...
User avatar
percios
Posts: 7
Joined: Sun Sep 17, 2017 3:05 pm

Re: Problem to fill a form with same IDs and dynamic CONTENT

Post by percios » Sat Sep 23, 2017 11:22 am

Your precedent macro it seemed perfect but wasn't work, I was going crazy :P but at the end I found the error and thanks to your help I solved and learned something about relative positionig.

The error was in the "third tag" of every "questions"

Not correct code:

Code: Select all

TAG POS=1 TYPE=H1 ATTR=TXT:*Come<SP>si<SP>chiamano<SP>i<SP>Fanfoni
TAG POS=R1 TYPE=INPUT:TEXT FORM=ID:questioncontainer ATTR=NAME:answer[] CONTENT=Blue
TAG POS=1 TYPE=INPUT:SUBMIT FORM=ID:questioncontainer ATTR=*
Correct code (with the second TAG POS=R1)

Code: Select all

TAG POS=1 TYPE=H1 ATTR=TXT:*Come<SP>si<SP>chiamano<SP>i<SP>Fanfoni
TAG POS=R1 TYPE=INPUT:TEXT FORM=ID:questioncontainer ATTR=NAME:answer[] CONTENT=Blue
TAG POS=R1 TYPE=INPUT:SUBMIT FORM=ID:questioncontainer ATTR=*
Without this modify, macro clicked the submit bottom even if the answer was wrong.

Final code

Code: Select all

SET !TIMEOUT_PAGE 2
SET !ERRORIGNORE YES


TAG POS=1 TYPE=H1 ATTR=TXT:*Come<SP>si<SP>chiamano<SP>i<SP>Patarioti?
TAG POS=R1 TYPE=INPUT:TEXT FORM=ID:questioncontainer ATTR=NAME:answer[] CONTENT=Yellow
TAG POS=R1 TYPE=INPUT:SUBMIT FORM=ID:questioncontainer ATTR=*

TAG POS=1 TYPE=H1 ATTR=TXT:*Come<SP>si<SP>chiamano<SP>i<SP>Fanfoni
TAG POS=R1 TYPE=INPUT:TEXT FORM=ID:questioncontainer ATTR=NAME:answer[] CONTENT=Blue
TAG POS=R1 TYPE=INPUT:SUBMIT FORM=ID:questioncontainer ATTR=*

TAG POS=1 TYPE=H1 ATTR=TXT:*Come<SP>si<SP>chiamano<SP>i<SP>Nansoni?
TAG POS=R1 TYPE=INPUT:TEXT FORM=ID:questioncontainer ATTR=NAME:answer[] CONTENT=Red
TAG POS=R1 TYPE=INPUT:SUBMIT FORM=ID:questioncontainer ATTR=*

TAG POS=1 TYPE=H1 ATTR=TXT:*Come<SP>si<SP>chiamano<SP>i<SP>Tandani?
TAG POS=R1 TYPE=INPUT:TEXT FORM=ID:questioncontainer ATTR=NAME:answer[] CONTENT=Green
TAG POS=R1 TYPE=INPUT:SUBMIT FORM=ID:questioncontainer ATTR=*

TAG POS=1 TYPE=H1 ATTR=TXT:*Come<SP>si<SP>chiamano<SP>i<SP>Preteresi?
TAG POS=R1 TYPE=INPUT:TEXT FORM=ID:questioncontainer ATTR=NAME:answer[] CONTENT=Violet
TAG POS=R1 TYPE=INPUT:SUBMIT FORM=ID:questioncontainer ATTR=*
Thank you so much, I'm very happy :D
Last edited by percios on Sat Sep 23, 2017 9:37 pm, edited 1 time in total.
Browser: Mozilla Firefox 55.0.3 (64 bit)
Microsoft Windows 10 Pro 64 bit
Imacros version:VERSION BUILD=9030808
Post Reply