View Full Version : Making a script run slower (on purpose)...
QuackHead
08-19-2003, 04:39 PM
IS there a way in ASP to make the script pause?
I know how to do this in JavaScript, but not ASP....
Basically, I want one line of code to run, then the next line of code will run 1 second later...
Any ideas?
~Quack
arnyinc
08-19-2003, 05:04 PM
I'm pretty sure I borrowed this idea from whammy. It gets the job done, but you'll be cycling with the server quite a bit. I don't know what the resource implcations are.
<%
response.write "Do your first operations.<br>"&vbcrlf
StartTime = Timer()
WaitTime = 3 'enter the time in seconds
TimeDiff=Timer()-StartTime
While TimeDiff < WaitTime
TimeDiff = Timer()-StartTime
Wend
response.write "Time's up"&vbcrlf
%>
QuackHead
08-19-2003, 05:22 PM
Originally posted by arnyinc
I'm pretty sure I borrowed this idea from whammy. It gets the job done, but you'll be cycling with the server quite a bit. I don't know what the resource implcations are.
In other words... it'd slow the system quite a bit?
Roy Sinclair
08-19-2003, 06:15 PM
Originally posted by QuackHead
In other words... it'd slow the system quite a bit?
Without a doubt. I'd place a Do NOT use for production web pages disclaimer on that code.
QuackHead
08-19-2003, 06:35 PM
Is there any other way to do it?
arnyinc
08-19-2003, 07:04 PM
I don't want to discourage anyone else from answering, but I'm almost sure that there is no way to do this on the server side with ASP. There are many other ways to do it client side (javascript, meta tags) and server side (PHP, CGI, maybe ASP.NET) and even with a VBS file, but you'll end up with an ugly loop or pausing threads if you do it in ASP.
I figure this will encourage other people to answer, because everyone looooooves proving me wrong.
oracleguy
08-19-2003, 07:10 PM
Maybe if we had a better idea on why you want to slow the code down. Usually thats the opposite of what you are trying to do.
Maybe we can find a way to do what you want without having to put a delay in.
whammy
08-21-2003, 05:48 PM
I agree with Oracleguy. If it's possible to use setTimeout() client-side or something, I'd definitely go for that approach instead... what are you trying to accomplish?
vBulletin® v3.8.2, Copyright ©2000-2012, Jelsoft Enterprises Ltd.