..


Sponsored Links

Launching an ASP script using scheduled task

Article written by Max Bossi

One of the classic problems that afflict Windows developers is to manage the 'automatic execution of certain scripts (ASP, ASPX, etc..) Schedule and set dates.

A typical example of such a need may be to a hypothetical manutenzione.asp script that performs precisely the maintenance and / or back up the database of our site.

Manage the same on a Linux machine would be much easier! Thanks to the crontab, and text browsers (such as. Lynx) of which Linux is rich, managing the launch of scripts at certain points it becomes very easy: just add the crontab line to run this simple script at midnight every day:

 



 0 0 * * * lynx-dump http://www.miosito.com/manutenzione.php

 
Unfortunately, on Windows it is a bit 'less intuitive ...

Note: This article is devoted to system administrators. If your site is hosted (and therefore do not have access to scheduled tasks on the server) you should ask your provider or you can simply make use of services such as remote-cron.com or webbasedcron.com .

A bit of VBScript to solve the problem ...

Using the Scheduled Tasks usually we used to throw some nice executable (such as antivirus or some disk defragmentation utility) ... but how can we do to set the execution of an ASP script present on the same or another server?

In reality the operation is very simple. And 'enough, in fact, create a small script (VBScript) with the following content:






 'I create the object







 Dim IE







 September IE = CreateObject ("InternetExplorer.Application")









 'I give silent operation







 '(If it is set to True, you open the explorer window







 'In the middle of our video)







 IE.Visible = False









 'Sets the website to visit ...







 '... That is the URL of the script that I run!







 IE.navigate ("http://www.miosito.com/manutenzione.asp")









 'Close







 September IE = Nothing

 

Save with the extension. Vbs, and then we set the operation pianficata:
 



 Control Panel> Scheduled Tasks> Add Scheduled Task

 
Click Next and then Browse. Select the vbs file you created and set your preferences as to the time when you want the task to be performed.

In essence: the scheduled task will launch (with deadlines) vbs file which in turn will open an instance of (invisible) in IExplorer reaching the URL of the script that you want. Simple, right?

In the same category ...
E-Learning
ASP Zero (Ebook) ASP Zero (Ebook)
Learning Microsoft ASP and VBScript from scratch. At only 29 €.
Visual Basic 6 (Course) Visual Basic 6 (Course)
Make Desktop Applications with VB6. From 39 €.
Sponsored Links