Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

Sleeping in ASP

Posted on 2000-04-10
8
Medium Priority
?
760 Views
Last Modified: 2008-03-10
Is there a way to pause or sleep during an ASP script.  Im writing a script in that I want the user to think that the computer is thinking, so I need some kind of sleep() function that will pause the script for about 10 seconds or so.

Thanks,
-Dan
0
Comment
Question by:dmaroff
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
8 Comments
 
LVL 1

Expert Comment

by:eladr
ID: 2700993
i think you can build a function
in javascript that do nothing and to set up setTimeout for this function.

elad
0
 
LVL 2

Expert Comment

by:bagi112599
ID: 2701141
say

<% response.buffer=true%>
before <html> tag
and
when you need a sleep
call...
<%

myMinutes =2
Response.Flush
goSleep (myMinutes) %>

<%
function goSleep(myMinutes)
dim  koef, timekiller
     koef=60*100000
for i=0 to myMinutes*koef
  timekiller=timekiller+1
  timekiller=timekiller-1
next

end function
%>
<br>
finished sleeping.

where koef is some value you have to adjust depending on your
server CPU speed.
But, depending on now much your server is busy, you will get not exact amount time of sleep.
hope it helps

bagi
0
 
LVL 4

Accepted Solution

by:
ruperts earned 120 total points
ID: 2701243
This will set you back exactly 10 seconds!

curr_time = now()
do while curr_time>dateadd("s",-10,now())
'do nothing
loop
0
What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

 
LVL 15

Expert Comment

by:robbert
ID: 2701469
And, another one:

<%
Sub Sleep(intMilliseconds)
    dteEnd = DateAdd("s", intMilliSeconds/1000, Now)
    Do While dteEnd > Now
        'Sleep
    Loop
End Sub

Call Sleep(5000)
Response.Write "Something"
%>
0
 

Author Comment

by:dmaroff
ID: 2701509
Good thinking it works great.  The only thing is that if I have a form that is posting to this page, it doesn't show this page until the page completely ends.  Any way around this?

Thanks,
-Dan
0
 
LVL 4

Expert Comment

by:ruperts
ID: 2701521
<% response.buffer=true%>
Pre wait code...

<% Response.Flush %>

waiting loop goes here!

<% Response.Flush %>
0
 
LVL 15

Expert Comment

by:robbert
ID: 2701623
ruperts' code is an endless loop...
I've been too late.
0
 
LVL 4

Expert Comment

by:ruperts
ID: 2701666
Q: why is it endless??

A: It's not.

Except:
It is only endless if time stands still! But then if time stood still you wouldn't know that you where actually waiting for it to finish as time would not be passing!

(The above doesn't apply if time goes backwards - that's a whole new theory!)
0

Featured Post

On Demand Webinar: Networking for the Cloud Era

Did you know SD-WANs can improve network connectivity? Check out this webinar to learn how an SD-WAN simplified, one-click tool can help you migrate and manage data in the cloud.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

I would like to start this tip/trick by saying Thank You, to all who said that this could not be done, as it forced me to make sure that it could be accomplished. :) To start, I want to make sure everyone understands the importance of utilizing p…
Have you ever needed to get an ASP script to wait for a while? I have, just to let something else happen. Or in my case, to allow other stuff to happen while I was murdering my MySQL database with an update. The Original Issue This was written…
This tutorial will teach you the special effect of super speed similar to the fictional character Wally West aka "The Flash" After Shake : http://www.videocopilot.net/presets/after_shake/ All lightning effects with instructions : http://www.mediaf…
We’ve all felt that sense of false security before—locking down external access to a database or component and feeling like we’ve done all we need to do to secure company data. But that feeling is fleeting. Attacks these days can happen in many w…

705 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question