469,303 Members | 1,949 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 469,303 developers. It's quick & easy.

Run ASP Script as Scheduled Job

Hi All,

I want to perform the simple task of running an ASP script as a scheduled
job.

Previously I've always either run a .vbs script via windows Scheduler, or
put some logic in my global.asa, both of which have worked fine.

Unfortunately there are technical reasons (too complicated to go into here)
which mean I can't use either the global.asa or a standalone vbs script for
this job. It really does have to be an .asp script running in the
application space.

Running a scheduled job that runs the command "explorer
http://www.mydomain.com/myscript.asp" does the job, but will leave a new
window open every day, which will cause problems when sat on a remote
server. (self.close() at the end of the script just gives the "app trying
to close window" message and leaves window open)

Does anyone have any suggestions as to how to achieve this on a W2K server ?

Some kind of opening IE, running script, closing IE via VBS maybe ?

Any help much appreciated,

Regards,
Larry.
Jul 19 '05 #1
10 5682

Hi

I suggest lynx for win32 :
http://lynx.isc.org/release/

or Wget :
http://www.gnu.org/software/wget/wget.html

Both are scriptable (.bat file).

Wget allows you to POST data, load precise
cookies, ...

Have a nice day

Maxime Ducharme
Programmeur / Spécialiste en sécurité réseau

"Larry Neylon" <ln*****@nospam.ntlworld.com> wrote in message
news:vU***************@newsfe5-win.ntli.net...
Hi All,

I want to perform the simple task of running an ASP script as a scheduled
job.

Previously I've always either run a .vbs script via windows Scheduler, or
put some logic in my global.asa, both of which have worked fine.

Unfortunately there are technical reasons (too complicated to go into here) which mean I can't use either the global.asa or a standalone vbs script for this job. It really does have to be an .asp script running in the
application space.

Running a scheduled job that runs the command "explorer
http://www.mydomain.com/myscript.asp" does the job, but will leave a new
window open every day, which will cause problems when sat on a remote
server. (self.close() at the end of the script just gives the "app trying
to close window" message and leaves window open)

Does anyone have any suggestions as to how to achieve this on a W2K server ?
Some kind of opening IE, running script, closing IE via VBS maybe ?

Any help much appreciated,

Regards,
Larry.

Jul 19 '05 #2
write a .vbs script that uses techniques from
http://www.aspfaq.com/show.asp?id=2173 to retrieve the page. Then schedule
the .vbs script.

--
Mark Schupp
Head of Development
Integrity eLearning
www.ielearning.com
"Larry Neylon" <ln*****@nospam.ntlworld.com> wrote in message
news:vU***************@newsfe5-win.ntli.net...
Hi All,

I want to perform the simple task of running an ASP script as a scheduled
job.

Previously I've always either run a .vbs script via windows Scheduler, or
put some logic in my global.asa, both of which have worked fine.

Unfortunately there are technical reasons (too complicated to go into here) which mean I can't use either the global.asa or a standalone vbs script for this job. It really does have to be an .asp script running in the
application space.

Running a scheduled job that runs the command "explorer
http://www.mydomain.com/myscript.asp" does the job, but will leave a new
window open every day, which will cause problems when sat on a remote
server. (self.close() at the end of the script just gives the "app trying
to close window" message and leaves window open)

Does anyone have any suggestions as to how to achieve this on a W2K server ?
Some kind of opening IE, running script, closing IE via VBS maybe ?

Any help much appreciated,

Regards,
Larry.

Jul 19 '05 #3
On Tue, 07 Sep 2004 20:31:23 GMT, "Larry Neylon"
<ln*****@nospam.ntlworld.com> wrote:
I want to perform the simple task of running an ASP script as a scheduled
job.


See:

How do I schedule ASP files?
http://www.aspfaq.com/show.asp?id=2143

Jeff
Jul 19 '05 #4
Hi Jeff,

It looks like the solutions there involve changing the .asp page to a .vbs,
which I can't do in this example, or using the global.asa timer method,
which yet again is unavailable in this example.

I'll go through the response from Mark to see whether that will provide the
answer.

Thanks,
Larry.
"Jeff Cochran" <je*********@zina.com> wrote in message
news:41*****************@msnews.microsoft.com...
On Tue, 07 Sep 2004 20:31:23 GMT, "Larry Neylon"
<ln*****@nospam.ntlworld.com> wrote:
I want to perform the simple task of running an ASP script as a scheduled
job.


See:

How do I schedule ASP files?
http://www.aspfaq.com/show.asp?id=2143

Jeff

Jul 19 '05 #5
Hi Maxime,

Unfortunatley the server I will need to run this on is hosted by a different
company, who are reluctant to install 3rd party software on their servers
(understandable, given security issues), so I'll have to try and find a
native Windows solution if possible,

Thanks,
Larry.
"Maxime Ducharme" <md*******@cybergeneration.com> wrote in message
news:48p%c.155071$X12.2352@edtnps84...

Hi

I suggest lynx for win32 :
http://lynx.isc.org/release/

or Wget :
http://www.gnu.org/software/wget/wget.html

Both are scriptable (.bat file).

Wget allows you to POST data, load precise
cookies, ...

Have a nice day

Maxime Ducharme
Programmeur / Spécialiste en sécurité réseau

"Larry Neylon" <ln*****@nospam.ntlworld.com> wrote in message
news:vU***************@newsfe5-win.ntli.net...
Hi All,

I want to perform the simple task of running an ASP script as a scheduled job.

Previously I've always either run a .vbs script via windows Scheduler, or put some logic in my global.asa, both of which have worked fine.

Unfortunately there are technical reasons (too complicated to go into here)
which mean I can't use either the global.asa or a standalone vbs script

for
this job. It really does have to be an .asp script running in the
application space.

Running a scheduled job that runs the command "explorer
http://www.mydomain.com/myscript.asp" does the job, but will leave a new
window open every day, which will cause problems when sat on a remote
server. (self.close() at the end of the script just gives the "app trying to close window" message and leaves window open)

Does anyone have any suggestions as to how to achieve this on a W2K

server ?

Some kind of opening IE, running script, closing IE via VBS maybe ?

Any help much appreciated,

Regards,
Larry.


Jul 19 '05 #6
On Tue, 07 Sep 2004 20:31:23 GMT, "Larry Neylon"
<ln*****@nospam.ntlworld.com> wrote:
Hi All,

I want to perform the simple task of running an ASP script as a scheduled
job.

Previously I've always either run a .vbs script via windows Scheduler, or
put some logic in my global.asa, both of which have worked fine.

Unfortunately there are technical reasons (too complicated to go into here)
which mean I can't use either the global.asa or a standalone vbs script for
this job. It really does have to be an .asp script running in the
application space.

Running a scheduled job that runs the command "explorer
http://www.mydomain.com/myscript.asp" does the job, but will leave a new
window open every day, which will cause problems when sat on a remote
server. (self.close() at the end of the script just gives the "app trying
to close window" message and leaves window open)

Let me see if I understand you right.

You have a website on a host (located otherside of the world or
whereever))

From your machine you want to run a ASP file on the host like a normal
user would then close the browser when the job is done. Your machine
will be left on 24 hrs a day so it can run the scheduled job.

If so then the above seems to fine, except for the self.close()
problem.

I have read in the past a way round this, cant remember exactly how it
was done, but it was something to do with the opener property.
Something like:

self.opener = self;
self.close()

actually, I've just tested it and it worked fine:

<!doctype html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
</head>
<body>
<script type="text/javascript">
function closeMe() {
self.opener = self;
self.close();
}
</script>
<input type="button" value="Close Me" onclick="closeMe();">
</body>
</html>
Now you just need to work out when to run this in the browser. Might
be as simple as just putting it in the <body onload="closeMe();">
HTH

Al.


Does anyone have any suggestions as to how to achieve this on a W2K server ?

Some kind of opening IE, running script, closing IE via VBS maybe ?

Any help much appreciated,

Regards,
Larry.


Jul 19 '05 #7
Hi Mark,

Thanks for the link. The following code works, but has one problem, which
is really weird:

==============================
Dim url, xmlhttp

url = http://www.myserver.com/myscript.asp

Set xmlhttp = CreateObject("MSXML2.ServerXMLHTTP")

xmlhttp.open "GET", url, true

xmlhttp.send ""

MsgBox "Complete"

set xmlhttp = nothing

==============================

If the MsgBox is excluded the asp script on the server doesn't execute
correctly, but if I add the MsgBox the script runs exactly as I want it to.

Has anyone come across WSH behaviour that is dependent on a MSGBOX statement
?

Thanks,
Larry.

"Mark Schupp" <ms*****@ielearning.com> wrote in message
news:ek****************@TK2MSFTNGP12.phx.gbl...
write a .vbs script that uses techniques from
http://www.aspfaq.com/show.asp?id=2173 to retrieve the page. Then schedule
the .vbs script.

--
Mark Schupp
Head of Development
Integrity eLearning
www.ielearning.com
"Larry Neylon" <ln*****@nospam.ntlworld.com> wrote in message
news:vU***************@newsfe5-win.ntli.net...
Hi All,

I want to perform the simple task of running an ASP script as a scheduled job.

Previously I've always either run a .vbs script via windows Scheduler, or put some logic in my global.asa, both of which have worked fine.

Unfortunately there are technical reasons (too complicated to go into here)
which mean I can't use either the global.asa or a standalone vbs script

for
this job. It really does have to be an .asp script running in the
application space.

Running a scheduled job that runs the command "explorer
http://www.mydomain.com/myscript.asp" does the job, but will leave a new
window open every day, which will cause problems when sat on a remote
server. (self.close() at the end of the script just gives the "app trying to close window" message and leaves window open)

Does anyone have any suggestions as to how to achieve this on a W2K

server ?

Some kind of opening IE, running script, closing IE via VBS maybe ?

Any help much appreciated,

Regards,
Larry.


Jul 19 '05 #8
ljb

"Larry Neylon" <la***@nospam.ntlworld.com> wrote in message
news:OE**************@TK2MSFTNGP14.phx.gbl...
Hi Mark,

Thanks for the link. The following code works, but has one problem, which
is really weird:

==============================
Dim url, xmlhttp

url = http://www.myserver.com/myscript.asp

Set xmlhttp = CreateObject("MSXML2.ServerXMLHTTP")

xmlhttp.open "GET", url, true

xmlhttp.send ""

MsgBox "Complete"

set xmlhttp = nothing

==============================

If the MsgBox is excluded the asp script on the server doesn't execute
correctly, but if I add the MsgBox the script runs exactly as I want it to.
Has anyone come across WSH behaviour that is dependent on a MSGBOX statement ?


I suspect you may need to set the third parameter to .open as false. I seem
to recall experiencing some timing issues when I left it asynchronous. From
the MSDN library:

varAsync [optional]
A Boolean indicator of whether the call is asynchronous. The default is True
(the call returns immediately). If set to True, attach an onreadystatechange
property callback so that you can tell when the send call has completed.

LJB
Jul 19 '05 #9
Thanks LJB, that works a treat.

Working code:

============================
Dim url, xmlhttp

url = "http://www.myserver.asp/myscript.asp" ' ASP script to run

Set xmlhttp = CreateObject("MSXML2.ServerXMLHTTP")

xmlhttp.open "GET", url, false

xmlhttp.send ""

set xmlhttp = nothing

====================================

Many thanks all who helped,

Larry.

"ljb" <.> wrote in message news:eD****************@TK2MSFTNGP09.phx.gbl...

"Larry Neylon" <la***@nospam.ntlworld.com> wrote in message
news:OE**************@TK2MSFTNGP14.phx.gbl...
Hi Mark,

Thanks for the link. The following code works, but has one problem, which is really weird:

==============================
Dim url, xmlhttp

url = http://www.myserver.com/myscript.asp

Set xmlhttp = CreateObject("MSXML2.ServerXMLHTTP")

xmlhttp.open "GET", url, true

xmlhttp.send ""

MsgBox "Complete"

set xmlhttp = nothing

==============================

If the MsgBox is excluded the asp script on the server doesn't execute
correctly, but if I add the MsgBox the script runs exactly as I want it to.

Has anyone come across WSH behaviour that is dependent on a MSGBOX

statement
?


I suspect you may need to set the third parameter to .open as false. I

seem to recall experiencing some timing issues when I left it asynchronous. From the MSDN library:

varAsync [optional]
A Boolean indicator of whether the call is asynchronous. The default is True (the call returns immediately). If set to True, attach an onreadystatechange property callback so that you can tell when the send call has completed.

LJB

Jul 19 '05 #10
What EXACTLY does the ASP script do?

Larry Neylon wrote:
Hi All,

I want to perform the simple task of running an ASP script as a scheduled
job.

Previously I've always either run a .vbs script via windows Scheduler, or
put some logic in my global.asa, both of which have worked fine.

Unfortunately there are technical reasons (too complicated to go into here)
which mean I can't use either the global.asa or a standalone vbs script for
this job. It really does have to be an .asp script running in the
application space.

Running a scheduled job that runs the command "explorer
http://www.mydomain.com/myscript.asp" does the job, but will leave a new
window open every day, which will cause problems when sat on a remote
server. (self.close() at the end of the script just gives the "app trying
to close window" message and leaves window open)

Does anyone have any suggestions as to how to achieve this on a W2K server ?

Some kind of opening IE, running script, closing IE via VBS maybe ?

Any help much appreciated,

Regards,
Larry.

Jul 19 '05 #11

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

2 posts views Thread by Ward Germonpé | last post: by
3 posts views Thread by Harlin Seritt | last post: by
1 post views Thread by TiredOfSpam | last post: by
4 posts views Thread by Myth of Sisyphus\). | last post: by
5 posts views Thread by Pawel_Iks | last post: by
reply views Thread by suresh191 | last post: by
reply views Thread by harlem98 | last post: by
1 post views Thread by Geralt96 | last post: by
reply views Thread by harlem98 | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.