Development :
K-Meleon Web Browser Forum
K-Meleon development related discussions.
Time Delay\Loop
Posted by:
caraz
Date: January 29, 2005 05:38PM
I want to create something that requires some type of time delay/loop
I want it to execute X block of code every Y seconds
or, at least, wait Z seconds before executing X block of code
How can i does this in the macro language?
Is their a better tutorial for using the macro language that also covers all the basics?
Re: Time Delay\Loop
Posted by:
rmn
Date: January 29, 2005 07:23PM
No way to do it with current macro language, but if the code you want to execute can be rewritten in javascript, you can use its normal delayed-looping functions (whatever they are; I don't know much js). The Reload macro (the last one in macros.cfg) might help you.
Re: Time Delay\Loop
Posted by:
caraz
Date: January 29, 2005 08:32PM
can anyone break down/rewrite the reload macro so it can infinetly loop X block of code every Y seconds
or, can someone just provide fill in the blank macro (macro+javascript) code to accomplish this task
Re: Time Delay\Loop
Posted by:
fluxy
Date: April 12, 2005 10:26AM
I think that would be a great improvement in the macro language. Loops should be introduced and other conditional stuffs too. They are soooo useful
Re: Time Delay\Loop
Posted by:
rmn
Date: April 13, 2005 09:25AM
> Loops should be introduced
Loops are already available. Timed/delayed loops aren't.
> and other conditional stuffs too
What other?
Re: Time Delay\Loop
Posted by:
jsnj
Date: April 14, 2005 12:17AM
IIRC the original poster solved his request by using the event macros. Most common time delay requests can be solved by using the OnLoad macro.
Re: Time Delay\Loop
Posted by:
Anurag Jain
Date: March 07, 2006 11:06AM
for(i=0; i<len;i++)
{
statement 1;
pause(3000);
statement 2;
}
function pause(numberMillis) {
var now = new Date();
var exitTime = now.getTime() + numberMillis;
while (true) {
now = new Date();
if (now.getTime() > exitTime)
return;
}
}
Re: Time Delay\Loop
Posted by:
everling
Date: March 18, 2006 04:35PM
I haven't touched KM's macros, but Anurag Jain's code looks suspiciously like the Javascript language. If it is Javascript, there are the setTimeout and the setInterval functions.
Re: Time Delay\Loop
Posted by:
rmn
Date: March 19, 2006 01:19AM
Yeah, that's JS, not K-Meleon macro.
Re: Time Delay\Loop
Posted by:
shaggy
Date: March 29, 2006 04:50PM
Use setTimeInterval() function.
Re: Time Delay\Loop
Posted by:
mark307
Date: April 15, 2006 01:11PM
I posted timer plugin that offers function similar macro statement "id" but with frequently executing.
http://rapidshare.de/files/18065120/timer-0.0.1.zip.html
However, JavaScript is still only solution to do with specially page.
Thanks.
Re: Time Delay\Loop
Posted by:
Daniel Schoolman
Date: January 16, 2010 10:53PM
Here is how I make a loop that loops every millisecond:
<input value="" id="time" type="text"/>
<script type="text/javascript">
function SetTime()
{
document.getElementById("time").attributes[0].nodeValue=(new Date());
window.setTimeout("SetTime()",1);
}
SetTime()
</script>
It is possible to create a loop using functions instead of using a while loop, or for loop. The function just repeats it's self at the end of it, and i added a delay to it repeating it's self. This is one of my most logical pieces of work. We never have to use loops again because you can just use functions! ROFL
Re: Time Delay\Loop
Date: January 16, 2010 11:05PM
thanks daniel.. but(quoting romanito):
Quote
rmn
Yeah, that's JS, not K-Meleon macro.
that problem is now solved as macro language has been updated couple of years ago to include while {}loop
blast from the past?
Re: Time Delay\Loop
Posted by:
akrama
Date: October 19, 2011 04:58PM
Quote
Daniel Schoolman
Here is how I make a loop that loops every millisecond:
<input value="" id="time" type="text"/>
<script type="text/javascript">
function SetTime()
{
document.getElementById("time").attributes[0].nodeValue=(new Date());
window.setTimeout("SetTime()",1);
}
SetTime()
</script>
It is possible to create a loop using functions instead of using a while loop, or for loop. The function just repeats it's self at the end of it, and i added a delay to it repeating it's self. This is one of my most logical pieces of work. We never have to use loops again because you can just use functions! ROFL
yes you use looping concept in javascript.
Re: Time Delay\Loop
Date: January 25, 2012 11:51AM
Hoping this will help you...
Function sleep(seconds) from module time is pretty much the best. Remember seconds is a float so you can delay 0.5 seconds.
Python Syntax (Toggle Plain Text)
1.import_time
2.
3.print "Hello ..."
4.print "are you"
5.print "... there!"
Edited 1 time(s). Last edit at 01/25/2012 11:53AM by reena19_lko.