Ionut Bejinariu
Ionut Bejinariu

Reputation: 117

iMacros - Detect {{LOOP}} value number and scrol down the page

I found a solution for what I need, but maybe someone can help me optimize it.

When the {{LOOP}} value have 20 to 40,60,80,100,120,140,160, ... 2000... 10000... etc. or more, I need to Scroll Down the page with the value I need.

Because the WebPage is big and I should reach maybe 20000 as the value of {{LOOP}}. In this case, my solution seems a little out of hand. I would have to repeat the code in many lines.

SET !LOOP 20
SET !EXTRACT {{!LOOP}}

SET scrolla EVAL("var x='{{!EXTRACT}}'; var z; if(x=='20'){z=\"javascript:window.scrollBy(0,5000)\";} else{z=\"javascript:window.scrollBy(0,500)\";}; z;")
SET scrolla EVAL("var x='{{!EXTRACT}}'; var z; if(x=='40'){z=\"javascript:window.scrollBy(0,5000)\";} else{z=\"javascript:window.scrollBy(0,500)\";}; z;")
SET scrolla EVAL("var x='{{!EXTRACT}}'; var z; if(x=='60'){z=\"javascript:window.scrollBy(0,5000)\";} else{z=\"javascript:window.scrollBy(0,500)\";}; z;")

'URL GOTO={{scrolla}}
PROMPT {{scrolla}}

Someone have another solution for my problem? More optimized? and not using so many lines? thank you so much

I am using (FCI): iMacros for CR v10.1.1 'PE', CR v105.0.5195.102 (_x64), Win10_x64. ('CR' = 'Chrome' / 'PE' = 'Personal Edition')

Later edit: Another idea that crossed my mind would be to use a .csv and put 20, 40, 50 ... 1000 on the specific line to match the {{LOOP}}, and the other lines 0,0,0,0,. and in EVAL function I will use it (x=='{{!COL1}}') instead of (x=='20'), (x=='40')..

Upvotes: 1

Views: 120

Answers (0)

Related Questions