Running a script every minute 
Author Message
 Running a script every minute

All,

I would like a script to run once every minutes.  Right now I have the
script infinitely looping and pausing for a minute before running, which
keeps the script in memory and takes up about 2.5 megs that I don't want to
have to give up.  Does anybody have any idea for getting this script to run
once every minute?  AT doesn't seem to cut it because you can't schedule
something to run once every minute unless you go through and add every
stupid minute of the day which is definitely something I'm not going to do
:)

Thanks,
Michael McGuire



Sun, 30 Dec 2001 03:00:00 GMT  
 Running a script every minute
In addition:

I'm also noticing that the script is using 100 % of the CPU using the Sleep
method of the Wscript object (using Windows Scripting Host 2.0 Beta).  I
guess this is not the way I want to do it.  Any ideas on getting this to be
more efficient?

Thanks,

Mike


Quote:
> All,

> I would like a script to run once every minutes.  Right now I have the
> script infinitely looping and pausing for a minute before running, which
> keeps the script in memory and takes up about 2.5 megs that I don't want
to
> have to give up.  Does anybody have any idea for getting this script to
run
> once every minute?  AT doesn't seem to cut it because you can't schedule
> something to run once every minute unless you go through and add every
> stupid minute of the day which is definitely something I'm not going to do
> :)

> Thanks,
> Michael McGuire



Sun, 30 Dec 2001 03:00:00 GMT  
 Running a script every minute
I don't know about getting the system to run once a minute.  I haven't had
to do a sleep like thing in VBScript, however, I had to do it in VB 5.
There, I used a the DoEvents command in a routine.  I forget exactly how I
used it, but I'm sure you can look up DoEvents and find something.

BJ Wyatt

Quote:

>In addition:

>I'm also noticing that the script is using 100 % of the CPU using the Sleep
>method of the Wscript object (using Windows Scripting Host 2.0 Beta).  I
>guess this is not the way I want to do it.  Any ideas on getting this to be
>more efficient?

>Thanks,

>Mike



>> All,

>> I would like a script to run once every minutes.  Right now I have the
>> script infinitely looping and pausing for a minute before running, which
>> keeps the script in memory and takes up about 2.5 megs that I don't want
>to
>> have to give up.  Does anybody have any idea for getting this script to
>run
>> once every minute?  AT doesn't seem to cut it because you can't schedule
>> something to run once every minute unless you go through and add every
>> stupid minute of the day which is definitely something I'm not going to
do
>> :)

>> Thanks,
>> Michael McGuire



Sun, 30 Dec 2001 03:00:00 GMT  
 Running a script every minute
Actually, it seemed to be using 100% of the CPU and now when I run it it
utilizes no CPU time.  I'm wondering if I had the WScript.Sleep commented
out on accident or something because it seems to be working fine.  It's
still using a few megs of memory but if there is no other way to do it, I
guess this is the way to do it.

Mike


Quote:
> I don't know about getting the system to run once a minute.  I haven't had
> to do a sleep like thing in VBScript, however, I had to do it in VB 5.
> There, I used a the DoEvents command in a routine.  I forget exactly how I
> used it, but I'm sure you can look up DoEvents and find something.

> BJ Wyatt

> >In addition:

> >I'm also noticing that the script is using 100 % of the CPU using the
Sleep
> >method of the Wscript object (using Windows Scripting Host 2.0 Beta).  I
> >guess this is not the way I want to do it.  Any ideas on getting this to
be
> >more efficient?

> >Thanks,

> >Mike



> >> All,

> >> I would like a script to run once every minutes.  Right now I have the
> >> script infinitely looping and pausing for a minute before running,
which
> >> keeps the script in memory and takes up about 2.5 megs that I don't
want
> >to
> >> have to give up.  Does anybody have any idea for getting this script to
> >run
> >> once every minute?  AT doesn't seem to cut it because you can't
schedule
> >> something to run once every minute unless you go through and add every
> >> stupid minute of the day which is definitely something I'm not going to
> do
> >> :)

> >> Thanks,
> >> Michael McGuire



Sun, 30 Dec 2001 03:00:00 GMT  
 Running a script every minute
There is a tool in the resource kit called soon which will schedule a job a
number of seconds ahead, this may help.

Tony Edgecombe


Quote:
> All,

> I would like a script to run once every minutes.  Right now I have the
> script infinitely looping and pausing for a minute before running, which
> keeps the script in memory and takes up about 2.5 megs that I don't want
to
> have to give up.  Does anybody have any idea for getting this script to
run
> once every minute?  AT doesn't seem to cut it because you can't schedule
> something to run once every minute unless you go through and add every
> stupid minute of the day which is definitely something I'm not going to do
> :)

> Thanks,
> Michael McGuire



Sun, 30 Dec 2001 03:00:00 GMT  
 Running a script every minute
How about something recursive.  At the beginning of your script add the AT
command for the next minute.  When your script finishes it will be ready to
run again in the next minute.

Something like the following:

Dim WSHShell
Dim dTime

Set WSHShell = Wscript.CreateObject("WScript.Shell")
dTime = DateAdd("n", 1, Now)

WSHShell.Run ("%systemroot%\system32\at.exe "  & DatePart("h", dTime) & ":"
& DatePart("n", dTime) &  _
" yourabsolutepathname\yourfilename.vbs")

There is no error checking in this snippet so be careful.  I can see how
this script can get out of hand and cause major problems.  At a minimum I
would check for a current instance of the script and if it exists abort one
of them script.  This script will work with the Schedule service (that came
originally with NT) but not the Task Scheduler service that IE 5 installs.
I do not know why.  It has not be stressed tested and it only ran 10 minutes
so I do not know how robust this approach is over a long period.  Hope this
helps.


Quote:
> All,

> I would like a script to run once every minutes.  Right now I have the
> script infinitely looping and pausing for a minute before running, which
> keeps the script in memory and takes up about 2.5 megs that I don't want
to
> have to give up.  Does anybody have any idea for getting this script to
run
> once every minute?  AT doesn't seem to cut it because you can't schedule
> something to run once every minute unless you go through and add every
> stupid minute of the day which is definitely something I'm not going to do
> :)

> Thanks,
> Michael McGuire



Sun, 30 Dec 2001 03:00:00 GMT  
 Running a script every minute
I accomplished this using the NT Scheduler (part of the resource kit, I
believe?)

I had a script (at, say 3:00am) create a dummy flag file

at (say) 7:00am, my script kicks in, checks for the existance of this flag
file, and if it exists, it runs the script.  Once the script successfully
completes, it deletes the flag.

If the script sees that the flag file does NOT exist, the script quits
happily.

The scheduler allows the script to be repeated every x minutes (in the
advanced settings)

Hope this helps!
Kris

Quote:

>All,

>I would like a script to run once every minutes.  Right now I have the
>script infinitely looping and pausing for a minute before running, which
>keeps the script in memory and takes up about 2.5 megs that I don't want to
>have to give up.  Does anybody have any idea for getting this script to run
>once every minute?  AT doesn't seem to cut it because you can't schedule
>something to run once every minute unless you go through and add every
>stupid minute of the day which is definitely something I'm not going to do
>:)

>Thanks,
>Michael McGuire



Sun, 30 Dec 2001 03:00:00 GMT  
 Running a script every minute
No idea on how to do it but are you copying an image from a {*filter*} to a
website?  Just a guess.


Mon, 31 Dec 2001 03:00:00 GMT  
 Running a script every minute
Download the WSHExtend ActiveX control from my WSH Bazaar and use the
WSHWait method (which pauses your script for 60 seconds). Then you can use a
simple loop:

Set objAdr = WScript.CreateObject("WSHExtend.WinExt")

Do while (true)
' Do your task

objAdr.WSHWait 60000     ' Wait 60,000 milliseconds
End

Have a a look into the WSH Bazaar. The sample pages contain also samples.
More details are discussed within the WSH Tutorial.

G. Born

Check out my WSH Bazaar at:

http://ourworld.compuserve.com/homepages/Guenter_Born/index0.htm


Quote:
>I don't know about getting the system to run once a minute.  I haven't had
>to do a sleep like thing in VBScript, however, I had to do it in VB 5.
>There, I used a the DoEvents command in a routine.  I forget exactly how I
>used it, but I'm sure you can look up DoEvents and find something.

>BJ Wyatt

>>In addition:

>>I'm also noticing that the script is using 100 % of the CPU using the
Sleep
>>method of the Wscript object (using Windows Scripting Host 2.0 Beta).  I
>>guess this is not the way I want to do it.  Any ideas on getting this to
be
>>more efficient?

>>Thanks,

>>Mike



>>> All,

>>> I would like a script to run once every minutes.  Right now I have the
>>> script infinitely looping and pausing for a minute before running, which
>>> keeps the script in memory and takes up about 2.5 megs that I don't want
>>to
>>> have to give up.  Does anybody have any idea for getting this script to
>>run
>>> once every minute?  AT doesn't seem to cut it because you can't schedule
>>> something to run once every minute unless you go through and add every
>>> stupid minute of the day which is definitely something I'm not going to
>do
>>> :)

>>> Thanks,
>>> Michael McGuire



Mon, 31 Dec 2001 03:00:00 GMT  
 Running a script every minute
Careful, folks, SOON.EXE gives flaky results when used with the new
TaskScheduler (rather than the old AT scheduler). It's in the KB.
Quote:

> There is a tool in the resource kit called soon which will schedule a job a
> number of seconds ahead, this may help.

> Tony Edgecombe



Mon, 31 Dec 2001 03:00:00 GMT  
 Running a script every minute
Um no, why?


Quote:
> No idea on how to do it but are you copying an image from a {*filter*} to a
> website?  Just a guess.



Mon, 31 Dec 2001 03:00:00 GMT  
 Running a script every minute
If you use the new scheduler,
1.- Select the task you wiil like to schedule
2.- Rigth click and select properties
3.- Select the Schedule tab
4.- Next to the schedule start time click on the advanced.. buttom
5.- Check the repeat task and so on and so forth


Quote:
> All,

> I would like a script to run once every minutes.  Right now I have the
> script infinitely looping and pausing for a minute before running, which
> keeps the script in memory and takes up about 2.5 megs that I don't want
to
> have to give up.  Does anybody have any idea for getting this script to
run
> once every minute?  AT doesn't seem to cut it because you can't schedule
> something to run once every minute unless you go through and add every
> stupid minute of the day which is definitely something I'm not going to do
> :)

> Thanks,
> Michael McGuire



Wed, 02 Jan 2002 03:00:00 GMT  
 
 [ 12 post ] 

 Relevant Pages 

1. Schedule a script to run every 10 minutes.

2. script than will run every 15 minutes

3. how to schedule to run every 5 minutes

4. schedule vbs task every n minutes?

5. Schedule every 15 minutes

6. Call ASP every 15 minute (automatically)

7. Run a local script on every page clicked

8. Run script every 10 mn.

9. Minutes 2 Days Hours and Minutes

10. Run application script in the startup OK, but every time I log on the script runs again ???

11. Can vbscript run on every computer with windows?

12. run ASP page automaticly every hour/day

 

 
Powered by phpBB® Forum Software