How to add a delay to this code?

Discussions and Tech Support related to the iMacros Google Chrome extension.
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
Post Reply
brennj4
Posts: 1
Joined: Sat Feb 23, 2013 6:07 pm

How to add a delay to this code?

Post by brennj4 » Sat Feb 23, 2013 6:15 pm

Hi all, forgive this noob question. I am just learning.
I have this script that is working too fast. This script, when entered in the console on a soundcloud track that I own, adds the track to all of the groups that have the word electronic in the name. The problem is that it moves too fast for soundcloud, so I'd like to add a delay of 20 seconds between each iteration. Any help would be appreciated/

Code: Select all

var groupNameMatch = /electronic/i;
var i = 1;
$(".create-group").each(function(){
if($(this).attr("href").match(/contributions/i) && $(this).text().match(groupNameMatch)){
    //  75 groups max
    if(i > 75) return false;
    $(this).trigger("click");
    i++;
}
});
Post Reply