Results 1 to 15 of 15

Thread: (ASP & Win2K) How do I get my server to run an ASP script every minute? **Resolved**

  1. #1

    Thread Starter
    Frenzied Member msimmons's Avatar
    Join Date
    Jul 2001
    Location
    Houston, TX
    Posts
    1,057

    (ASP & Win2K) How do I get my server to run an ASP script every minute? **Resolved**

    (I know I am silly for posting a serious question at 3pm on a friday but...)

    I need to run a page once every minute. This will be on my webserver. I was thinking that i could add it to the task scheduler or something but not sure.

    thanks
    michael
    Last edited by msimmons; Nov 1st, 2002 at 06:13 PM.
    I'm off to GalahTech, hope to see you there.

    If you don't like the rules they make, refuse to play their game. -- Steve Ignorant.

  2. #2
    Hyperactive Member MarkusJ_NZ's Avatar
    Join Date
    Jun 2001
    Posts
    375
    Couple of ways that I can think of, use a scheduling program to schedule it or use the javascript timeout event to reload the page every minute.

    Code:
    <head>
    <script language="javascript">
    <!--
    function reloadMe()
    {
     var the_timeout = setTimeout("Redirect();",6000);
    }
    
    function Redirect()
    {
      document.loaction="./ASPPAGETORUN.asp"
    }
    // -->
    </script>
    </head>
    <body onLoad="javascript:reloadMe()">
    <%
     response.write "Heres some ASP code"
    %>
    </body>
    Save the above example as ASPPAGETORUN.asp and then run it. every minute the javascript timeout event will fire and the page will reload itself and execute the associated ASP...

    I would probably use a scheduling program but the above should work if you can't be bothered

    HTH
    MarkusJ

  3. #3
    Hyperactive Member MarkusJ_NZ's Avatar
    Join Date
    Jun 2001
    Posts
    375

    Slight error in code

    Whoops, replace
    Code:
    <body onLoad="java script:reloadMe()">
    with

    Code:
    <body onLoad="javascript:reloadMe()">

  4. #4

    Thread Starter
    Frenzied Member msimmons's Avatar
    Join Date
    Jul 2001
    Location
    Houston, TX
    Posts
    1,057
    Can you give some examples of scheduling programs? Will MS's task scheduler work?
    I'm off to GalahTech, hope to see you there.

    If you don't like the rules they make, refuse to play their game. -- Steve Ignorant.

  5. #5
    Hyperactive Member MarkusJ_NZ's Avatar
    Join Date
    Jun 2001
    Posts
    375
    Hi, From what I can see, the task scheduler is used to schedule applications to run at a certain time... I am not sure if you can schedule IE to run at a certain time and then go to the page to execute the ASP. If this is the case you would probably be better just running the javascript function I previously posted...

    Why do you need the ASP page to run every minute? Have you thought of just making a little VB app that does what the ASP page does and then scheduling the APP via MS scheduler?

    Cheers
    Mark

  6. #6

    Thread Starter
    Frenzied Member msimmons's Avatar
    Join Date
    Jul 2001
    Location
    Houston, TX
    Posts
    1,057
    Originally posted by MarkusJ_NZ

    Why do you need the ASP page to run every minute? Have you thought of just making a little VB app that does what the ASP page does and then scheduling the APP via MS scheduler?

    Cheers
    Mark [/B]
    cos I'm rusty w/vb I could set the home page of IE to my app then have the scheduler run it.

    What scheduler programms were you referring to before?
    I'm off to GalahTech, hope to see you there.

    If you don't like the rules they make, refuse to play their game. -- Steve Ignorant.

  7. #7
    Hyperactive Member MarkusJ_NZ's Avatar
    Join Date
    Jun 2001
    Posts
    375
    Hi again ,

    I am pretty certain that scheduling programs can only run applications so running a ASP page directly would be a problem. You will need to create a app and then schedule the app via Windows scheduling (there's a wizard under Start-Programs-Accessories-System tools-Scheduled tasks)

    Do you have a copy of VB 6? If so, I can probably whip something up real quick that will help you out.....

    Cheers

  8. #8
    Hyperactive Member MarkusJ_NZ's Avatar
    Join Date
    Jun 2001
    Posts
    375
    Here's a Zip of a VB 6 app which should do what you are after.
    Just replace the Const variable sURL value to the address of the ASP page which you want called every minute.

    Compile the program as an application somewhere and then use the task scheduler to run that app once. The timer on the form goes off once a minute and refreshes the ASP page...

    Cheers
    MarkusJ
    Attached Files Attached Files

  9. #9

    Thread Starter
    Frenzied Member msimmons's Avatar
    Join Date
    Jul 2001
    Location
    Houston, TX
    Posts
    1,057
    Thanks! I've been pulled away from that project for hte time being but will let you know how it works out
    Michael
    I'm off to GalahTech, hope to see you there.

    If you don't like the rules they make, refuse to play their game. -- Steve Ignorant.

  10. #10

    Thread Starter
    Frenzied Member msimmons's Avatar
    Join Date
    Jul 2001
    Location
    Houston, TX
    Posts
    1,057
    I finaly got around to installing VB6 on this machine. It looks like it will work great One question (I'm rusty w/VB and the webbrowser thing) how do I close and then reopen the page rather than refresh it?
    Thanks again!
    Michael
    I'm off to GalahTech, hope to see you there.

    If you don't like the rules they make, refuse to play their game. -- Steve Ignorant.

  11. #11

    Thread Starter
    Frenzied Member msimmons's Avatar
    Join Date
    Jul 2001
    Location
    Houston, TX
    Posts
    1,057
    That way it kills any asp session variables hanging around.
    I'm off to GalahTech, hope to see you there.

    If you don't like the rules they make, refuse to play their game. -- Steve Ignorant.

  12. #12

    Thread Starter
    Frenzied Member msimmons's Avatar
    Join Date
    Jul 2001
    Location
    Houston, TX
    Posts
    1,057
    K... i have every thing worked out and it works great!
    Thanks a million!
    I'm off to GalahTech, hope to see you there.

    If you don't like the rules they make, refuse to play their game. -- Steve Ignorant.

  13. #13
    Hyperactive Member MarkusJ_NZ's Avatar
    Join Date
    Jun 2001
    Posts
    375
    Glad that it worked
    Cheers
    MarkusJ

  14. #14
    Hyperactive Member ashay's Avatar
    Join Date
    Feb 2002
    Location
    Mumbai,India
    Posts
    278
    hi,

    well....u can use VBS files with the task scheduler.Create a vbs file with the functionality u want .U can ccess database/send emails/create files etc. in the VBS file.It is similar to an asp file.Then add it to the task scheduler.

    regds,
    ashay
    "If you should die before me, ask if you could bring a friend."
    - Stone Temple Pilots

  15. #15
    Hyperactive Member
    Join Date
    Feb 2001
    Posts
    280
    hi,

    I think you wouldnt even need a vbs file, can leave the code as asp/html.
    (if the code was asp, how can U address, say servervariable in vbs...)

    I do this by making IE jump to the webpage via schedule - (this causing the asp to run on the server....)

    following cmd added to the schedule with "AT".....

    "C:\Program Files\Internet Explorer\IEXPLORE.EXE" http://server/page.asp

    no worries,

    cheers, A.J.P

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width