5

There are some imacro with Javascript conditional questions on here, but nothing that gave me what I need... I tried this question: http://forum.imacros.net/viewtopic.php?f=11&t=14010, but mine is different as I don't need to use the EXTRACT command because I already know the words in the text ...I can't figure out why this isn't working... I have a feeling the logic here is off (if(macro=="Follow"){) but I don't know for sure.

I am trying to set up an imacro for following people on Pinterest. What I would like to accomplish is that once it reaches the end of the page it is following people on, it will scroll down to reveal more people to follow.

Also, if I type in a search for a keyword where everyone on the first page is already followed, I would like it to scroll down until it reaches users I have not followed - even if it has to run this code (URL GOTO=javascript:window.scrollBy(0,20000)) multiple times to pass multiple pages to get to the new set of people I have not followed.

I used this code for the scoll down: URL GOTO=javascript:window.scrollBy(0,20000). I am having problems, however because I cannot figure out the conditional... I approached it by if there was not "Follow" text (no one to follow), then it would jump out of the if statement, and to the else statement. It would scroll down until it reached someone to follow and run the macro after it had reached someone (without wasting another increment in the for loop.

Here's the code:

// Location where the imacro goes.
window.location="http://www.pinterest.com/search/boards/?q=ponies" + "\n";
// Gives time for the page to load.
var macro = "WAIT SECONDS=10" + "\n";
// Sets no delay time between each step.
var macro = "CODE:SET !REPLAYSPEED FAST" + "\n";
// Tells imacro to ignore errors.
var macro = "CODE:SET !ERRORIGNORE YES" + "\n";
// Sets the timeout for missing tags to 0 seconds (not 6 seconds).
var macro = "CODE:SET !TIMEOUT_STEP 0" + "\n";

// Clicks the "follow button on Pinterest."
macro += "TAG POS=1 TYPE=BUTTON ATTR=TXT:Follow" + "\n";
// Waits the given number (rand) of time.  
macro += "WAIT SECONDS={{rand}}" + "\n";

// -------------------------------------------------------- \\

// Loops 200 times through the two 'macro' steps located above.
for(var i=0;i<200;i++)    
{
    if(macro=="Follow"){
    // Sets a random amount of time for WAIT SECONDS for each step.
    var rand = Math.random()*7 + 5;
    // Shows what number i is.
    iimDisplay(i);    
    // Replaces i with the new i (after one loop).
    iimSet("i", i);
    // Replaces rand with the new rand (after one loop).   
    iimSet("rand", rand); 
    // Plays the imacro.
    iimPlay(macro);
    }
    else{
    // Scrolls down the page.
    var macro = "URL GOTO=javascript:window.scrollBy(0,20000)" + "\n";
    // Sets a random amount of time for WAIT SECONDS for each step.
    var rand = Math.random()*7 + 5;
    // Shows what number i is.
    iimDisplay(i);    
    // Replaces i with the new i (after one loop).
    iimSet("i", i);
    // Replaces rand with the new rand (after one loop).   
    iimSet("rand", rand); 
    // Plays the imacro.
    iimPlay(macro);
    }
}

1 Answers1

0

You can replace this line

var macro = "URL GOTO=javascript:window.scrollBy(0,20000)" + "\n";

with

window.scrollTo(0,window.document.body.scrollHeight);
Rafayet Ullah
  • 1,108
  • 4
  • 14
  • 27