How to run ASP files periodically (reprint)

Source: Internet
Author: User
Timed at a certain time, to run a regular ASP file to perform a task, such as a factory at 9 o'clock in the morning to collect all the meter readings, of course, through in-SQL connection to the various meters, we are now using an ASP file to the table in the SQL of the reading again to focus on MS SQL.





you might see a number of ways to run ASP files at timed intervals, but what I'm going to say now is a simple way to use a scheduled task to achieve it.





first, you have to write a JS or VBS file to invoke all of your executed ASP. Here are the JS and VBS file code, you can choose one, the execution effect is the same.





VBS code Copy Box


' CODE by small Lotus aston314@sohu.com ' Create an instance of IE Dim ie Set ie = CreateObject ("Internetexplorer.application") ' Run your URL ie.navigate ("http://www.blueidea.com/") ie.visible=1 ' clean up ... Set IE = Nothing








you can take any name, but suffix name must be VBS, where we name Do.vbs.





JS code Copy box


CODE by small Lotus aston314@sohu.com//Create the HTML message to display. var html = ""; html = "<html><head><title> run window </title></head><body>"; HTML + + "<font face=verdana></font>"; HTML + "</body></html>"; Create Internet Explorer Object ie = new ActiveXObject ("Internetexplorer.application"); Define How the window should look Ie.left = 50; Ie.top = 50; Ie.height = 510; Ie.width = 470; Ie.menubar = 0; Ie.toolbar = 0; Set the browser to a blank page ie.navigate ("http://www.blueidea.com/"); Show the browser ie.visible=1; Open a stream and write data. Ie.document.open; Ie.document.write (HTML); Ie.document.close;


You can also take any name, but the suffix must be JS, where we name Do.js.





the code in the file is not explained here.





just replace all the http://www.blueidea.com/in the above file with the URL address of the ASP file you want to execute. Here is the URL address, not the absolute address.





then open the task plan for WINDOWS, just like selecting any executable file, select the location of the above do.js or Do.vbs file, set the execution time, and so on, OK.





then this ASP file can be scheduled to be scheduled to run the task, simple.





as the beginning said, the task plan can be implemented at 9 in the morning, the ASP file, the meter readings collected in MS SQL.








Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.