acozme wrote: ↑Fri Apr 24, 2020 6:50 pm
Sorry about missing the info:
Code: Select all
iMacros free 12.6.505.4567 for Internet Explorer
IE 11.778.18362.0
Windows 10 64 bits
OK, perfect for your FCI...
(And next time you open a Thread, include that Info directly in your OP, preferably at the very top, I usually don't read and certainly don't answer if that Required Info is not mentioned...)
>>>
Alright..., hum, first your "obvious Mistake" is that both Double Quotes around the '{{!EXTRACT}}' Var in your 'EVAL()' Statements both need to be Escaped each time, not only the 1st one, ah-ah...!
And instead of using 'Escaped Double Quotes', you can also 'Single Quotes'... that don't need to be Escaped, that's the Syntax I always use myself...
>>>
Then you have 4x 'EVAL()' Statements, but because they all use the same "!VAR1" Var, then hum..., for iMacros, only the last one "really" gets executed and retained for later Reuse in your 'TAG' Statement at the end of your Script..., which is obviously not the Behaviour that you want...
They all 4 get "executed", but each time the "next one" replaces the Result from the previous one, as you keep using the same Var..., and in the end, only the last one "counts"...
There are 3 Methods to achieve the Functionality that you want:
- Method 1:
=> if else if else if else if else... etc...
- Method 2:
=> 'switch'/'case'/'break'.
- Method 3:
'EVAL()' + '!Var1' x times, a bit like you were doing, but you need to reuse (the previous) '!VAR1' inside every 'EVAL()' Statement from the 2nd Instance to keep building your if + if + if etc...
Methods 1 & 2 will produce ONE (very) long 'EVAL()' Statement, especially with your long Strings like '¿Cuál de los siguientes es un color: libro, nariz, verde, queso?' etc..., but it works and is easy to debug with just 1 'PROMPT' to follow your Vars...
I have one Method 1 'EVAL()' Statement in several of my Scripts that I still use daily, and only that Multiple 'if' 'EVAL()' Statement is 300Kb long, oops...!
I made it 8 or 10 years ago, when I started using JS in 'EVAL()', and yep, it could be shortened drastically, I vaguely tried once about 5 years ago, but was too much "Thinking" and I gave up after 1h and never tackled it again..., mostly because it still works perfectly, and I never had to ask for any Help for any of my Scripts, or I would feel a mini-little-bit "ashamed" about this one, ah-ah...!
Method 3 is normally not the "Best Practice" in my Opinion, and not easy to debug, or you need several 'PROMPT' Statements (one for each '!VAR1'), but it produces short 'EVAL()' Statements that don't require scrolling horizontally for 10 or 20 Screens ah-ah...!, and because of the 'Free' iMacros Version you are using, which only supports 3 Vars, hum..., that might actually be the "best Option" for you, after all...
- (F)CI(M) = (Full) Config Info (Missing): iMacros + Browser + OS (+ all 3 Versions + 'Free'/'PE'/'Trial').
- FCI not mentioned: I don't even read the Qt...! (or only to catch Spam!)
- Script & URL help a lot for more "educated" Help...