Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Categories

Periodically executing an ASP

I need to write an ASP page that automatically runs periodically (every day or every month or so).
How is this done?

Thanks
nICO

[hr]
[italic]How beautiful, if sorrow had not made Sorrow more beautiful than Beauty itself.[/italic]
JOHN KEATS

Comments

  • alexzhenalexzhen Member Posts: 13
    : I need to write an ASP page that automatically runs periodically (every day or every month or so).
    : How is this done?
    :
    : Thanks
    : nICO
    :
    : [hr]
    : [italic]How beautiful, if sorrow had not made Sorrow more beautiful than Beauty itself.[/italic]
    : JOHN KEATS
    :
    :

    hi, i hope would help you out.

    <%
    Dim run
    Set query = Request.QueryString
    run = query("run")
    %>

    title here

    var timer = null;
    /*
    //for every month or any time, you can do this way
    //date begin at 5 p.m of 10/17/2002.
    var start = new Date(2002, 9, 17, 17, 0, 0).getTime();
    var current = new Date().getTime();
    var days = (current - start) /(24 * 60 * 60 * 1000);
    var days_auto = 1;
    if (days >= days_auto){
    //update the query string or the file to current time.
    location = //current file
    }setTimeout(some method, 1000);
    */
    // this method periodically every day only.
    function ts(){
    //auto run at any time that great than or equal to 10 a.m
    var h = 10;
    var m = 0;
    var s = 0;
    var d = new Date();
    var _h = d.getHours();
    var _m = d.getMinutes();
    var _s = d.getSeconds();
    if (_h == 0 && <%=run & "==1"%>)
    location = "test.asp?run=0";
    else if ((_h >= h || _m >= m || _s >= s) && <%=run & "==0"%>)
    location = "test.asp?run=1";
    setTimeout("ts()", 1000); //check every 1 second.
    }








  • chick80chick80 Member Posts: 349
    Thank you for your answer.
    But what exactly I need to know is this: the code you posted has to be included in a page where users go frequently, I suppose, to check for the date.
    What I need is something free from user input...
    Suppose I want to backup a DB automatically every month (and I don't want/need users that mess with this :-))
    Is there a way to instruct the server to periodically do this?

    Thanks
    nICO

    [hr]
    [italic]How beautiful, if sorrow had not made Sorrow more beautiful than Beauty itself.[/italic]
    JOHN KEATS


  • alexzhenalexzhen Member Posts: 13
    : Thank you for your answer.
    : But what exactly I need to know is this: the code you posted has to be included in a page where users go frequently, I suppose, to check for the date.
    : What I need is something free from user input...
    : Suppose I want to backup a DB automatically every month (and I don't want/need users that mess with this :-))
    : Is there a way to instruct the server to periodically do this?
    :
    : Thanks
    : nICO
    :
    : [hr]
    : [italic]How beautiful, if sorrow had not made Sorrow more beautiful than Beauty itself.[/italic]
    : JOHN KEATS
    :
    :
    :

    hi again, ok maybe this should help. if you use IE browser, you can get rid of anything except the panel that should free from user input and you should disable ALT-CTRL-DEL that prevent the user stop the program.
  • robert2504robert2504 Member Posts: 3
    This is a little hard to do but this is how I am handling at my work. Using the Task Scheduler on the server, you can actually tell it to run Internet Explorer everyday at 5:00 p.m. So everyday, the server goes and launches Internet Explorer to the Homepage that you tell it. So you can tell it to run http://www.mysite.com/everyday.asp by making it the home page. The only problem here is that if it launched Internet Explorer today, tomorrow it will not run the asp since Internet Explorer is still opened unless someone went to the server and closed it.

    The way I solved this problem was to create my own Internet Explorer with my page as the homepage. This browser that I created with visual basic, will go to the site that it has been told and stays there for 5 seconds and then it closes itself. It has to stay there for 5 seconds because if it is to fast then the asp will not execute.

    So here are the basic:

    1. Create minibrowser that will open your page and close itself after 5 seconds. Put the executable anywhere on the server (windows 2000 server).

    2. Create a schedule task on the server that will launch this minibrowser everyday at the time that you want.

    That should be it.


    Robert Hernandez

    http://www.rgvwebs.com
    robert2504@msn.com

    : I need to write an ASP page that automatically runs periodically (every day or every month or so).
    : How is this done?
    :
    : Thanks
    : nICO
    :
    : [hr]
    : [italic]How beautiful, if sorrow had not made Sorrow more beautiful than Beauty itself.[/italic]
    : JOHN KEATS
    :
    :



  • chick80chick80 Member Posts: 349
    I'll try something like that!
    Thank you!

    nICO

    : This is a little hard to do but this is how I am handling at my work. Using the Task Scheduler on the server, you can actually tell it to run Internet Explorer everyday at 5:00 p.m. So everyday, the server goes and launches Internet Explorer to the Homepage that you tell it. So you can tell it to run http://www.mysite.com/everyday.asp by making it the home page. The only problem here is that if it launched Internet Explorer today, tomorrow it will not run the asp since Internet Explorer is still opened unless someone went to the server and closed it.
    :
    : The way I solved this problem was to create my own Internet Explorer with my page as the homepage. This browser that I created with visual basic, will go to the site that it has been told and stays there for 5 seconds and then it closes itself. It has to stay there for 5 seconds because if it is to fast then the asp will not execute.
    :
    : So here are the basic:
    :
    : 1. Create minibrowser that will open your page and close itself after 5 seconds. Put the executable anywhere on the server (windows 2000 server).
    :
    : 2. Create a schedule task on the server that will launch this minibrowser everyday at the time that you want.
    :
    : That should be it.
    :
    :
    : Robert Hernandez
    :
    : http://www.rgvwebs.com
    : robert2504@msn.com

  • brownbbrownb Member Posts: 18
    niCO:

    While both proposed suggestions answer your question, maybe you should rethink your method for doing what you are trying. Is there a _need_ to use ASP? If you're not doing anything that will rely on a browser window, it may be more efficient to port your ASP page to a Windows Script (VBS or JS). The conversion is easier than you might think, and you won't have to worry about spawning browser windows to execute code: you can simply schedule the script to run using Task Scheduler.

    More information here: http://search.microsoft.com/gomsuri.asp?n=2&c=rp_BestBets&siteid=us/dev&target=http://msdn.microsoft.com/scripting/



    : I'll try something like that!
    : Thank you!
    :
    : nICO
    :
    : : This is a little hard to do but this is how I am handling at my work. Using the Task Scheduler on the server, you can actually tell it to run Internet Explorer everyday at 5:00 p.m. So everyday, the server goes and launches Internet Explorer to the Homepage that you tell it. So you can tell it to run http://www.mysite.com/everyday.asp by making it the home page. The only problem here is that if it launched Internet Explorer today, tomorrow it will not run the asp since Internet Explorer is still opened unless someone went to the server and closed it.
    : :
    : : The way I solved this problem was to create my own Internet Explorer with my page as the homepage. This browser that I created with visual basic, will go to the site that it has been told and stays there for 5 seconds and then it closes itself. It has to stay there for 5 seconds because if it is to fast then the asp will not execute.
    : :
    : : So here are the basic:
    : :
    : : 1. Create minibrowser that will open your page and close itself after 5 seconds. Put the executable anywhere on the server (windows 2000 server).
    : :
    : : 2. Create a schedule task on the server that will launch this minibrowser everyday at the time that you want.
    : :
    : : That should be it.
    : :
    : :
    : : Robert Hernandez
    : :
    : : http://www.rgvwebs.com
    : : robert2504@msn.com
    :
    :

  • chick80chick80 Member Posts: 349
    Really, the situation is quite complicated...
    I need to run this ASP to automatically interact with the databases of my site, for example to delete unused or expired entries.
    I don't know if this is possible with JS or VBS, but the real problem is that I know there's some way to do this without using Task Scheduler or similar, but I don't know how it is done....

    Anyhow, thanks for your help.
    nICO


    [hr]
    [italic]How beautiful, if sorrow had not made Sorrow more beautiful than Beauty itself.[/italic]
    JOHN KEATS


  • robert2504robert2504 Member Posts: 3
    Well maybe it is time to switch to SQL Server or something that uses triggers. With triggers you can have the trigger get fired when an entry is older than 30 days and delete those entries.

    Just a thought.

    Robert
    : Really, the situation is quite complicated...
    : I need to run this ASP to automatically interact with the databases of my site, for example to delete unused or expired entries.
    : I don't know if this is possible with JS or VBS, but the real problem is that I know there's some way to do this without using Task Scheduler or similar, but I don't know how it is done....
    :
    : Anyhow, thanks for your help.
    : nICO
    :
    :
    : [hr]
    : [italic]How beautiful, if sorrow had not made Sorrow more beautiful than Beauty itself.[/italic]
    : JOHN KEATS
    :
    :
    :

  • Andre YoungAndre Young USAMember Posts: 0

    _________ \ http://forcoder.org \ free video tutorials and ebooks about [ PL/SQL C++ Visual Basic Go Python PHP R MATLAB Visual Basic .NET C Scratch JavaScript Swift Java Ruby Delphi C# Objective-C Assembly Perl Lua Apex Ada Scala Julia Fortran Alice Logo VBScript Crystal Scheme Transact-SQL SAS Awk FoxPro COBOL LabVIEW Kotlin ABAP Lisp Prolog Hack Dart Erlang Rust Bash Clojure ML F# D ] _______

Sign In or Register to comment.