Sign in to follow this  
Followers 0
jimg

Running a script on a schedule?

5 posts in this topic

I've got a trivial little script to load a screen wallpaper from an "of the day" website. If I try to use a scheduled task, it doesn't work properly, apparently because windows prevents scheduled tasks from affecting the user environment. So instead, I modified it to simply "sleep" for 24 hours and I just start it when I want it to do it's job. Works well enough except for two problems:

1) If I reboot at some point during the day, I have to run the program to get my wallpaper, and then stop and restart it at the correct time. (I know I could fix that by making the sleep command look at the absolute time before calling sleep).

But more seriously,

2) it seems the program may be causing a BSOD. It occurs rarely, and I'm still gathering evidence about the culprit. It's hard to believe the Sleep command has a bug in it. I'm running an up to date Windows 7/32bit.

The best solution would be if I could run the script at a prescribed time. Is there another way?

Share this post


Link to post
Share on other sites



There are a few ways to do something at a particular time, but one way would be to use an If loop and the time related macros, like this..

If @HOUR = 4 And @MIN = 20 Then MsgBox(0, "", "Yay!")

- Bruce /*somdcomputerguy */  If you change the way you look at things, the things you look at change.

Share this post


Link to post
Share on other sites

There are a few ways to do something at a particular time, but one way would be to use an If loop and the time related macros, like this..

If @HOUR = 4 And @MIN = 20 Then MsgBox(0, "", "Yay!")

I've done a few things like that and it brings your PC to it's knees or at least down on one knee. I'm hoping the BSOD turns out to be something else, and I'll just create the Sleep() argument using the time macros.

Share this post


Link to post
Share on other sites

I guess my PC has no knees because this script runs fine and shows 00 in the CPU column of the task manager.

While 1
    If @HOUR = 18 And @MIN = 20 Then MsgBox(0, "", "Yay!")
    Sleep(100)
WEnd

So I would think that there is something else in your code affecting the PC.


- Bruce /*somdcomputerguy */  If you change the way you look at things, the things you look at change.

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!


Register a new account

Sign in

Already have an account? Sign in here.


Sign In Now
Sign in to follow this  
Followers 0