Sign in to follow this  
Followers 0
yyyy273

Running a script overnight

8 posts in this topic

I have been trying to use Valuater's time machine 2 script to have a program run early in the morning when no one is on the computer. The problem is that it doesn't run.

; Time Machine #2
$start = "1:30"

While 1

    $time = @HOUR & ":" & @MIN

    If $start = $time Then
        Run("notepad.exe")
        ExitLoop
    EndIf

    Sleep(2000)

WEnd
Exit

I think the problem lays not within the code but within the settings on my computer. I have tried going to Display Properties and disabling the screensaver thinking that it could have caused the problem but no luck. I set system standby to never and turned off hibernation but that didn't help either.

Any help would be appreciated.

Thanks!

Share this post


Link to post
Share on other sites

Try putting the$time statement out side the while.. dunno but i think that might screw it up

Share this post


Link to post
Share on other sites

Try putting the$time statement out side the while.. dunno but i think that might screw it up

Then the $time wouldn't refresh and would stay at whatever time you started the script.

Share this post


Link to post
Share on other sites

Is an error produced? Does the script stop running at that point in time? Have you tried a full path to notepad?

Share this post


Link to post
Share on other sites

Is an error produced? Does the script stop running at that point in time? Have you tried a full path to notepad?

No error, script has been running for 24 hours or so now and nothing.

I have run it before no problem making the $start = @HOUR & ":" & @MIN + 1 but its just when I leave it running overnight that it doesn't work.

Share this post


Link to post
Share on other sites

I have been trying to use Valuater's time machine 2 script to have a program run early in the morning when no one is on the computer. The problem is that it doesn't run.

; Time Machine #2
$start = "1:30"

While 1

    $time = @HOUR & ":" & @MIN

    If $start = $time Then
        Run("notepad.exe")
        ExitLoop
    EndIf

    Sleep(2000)

WEnd
Exit

I think the problem lays not within the code but within the settings on my computer. I have tried going to Display Properties and disabling the screensaver thinking that it could have caused the problem but no luck. I set system standby to never and turned off hibernation but that didn't help either.

Any help would be appreciated.

Thanks!

@Hour returns in the range 00 to 23.

$start = "1:30" should be written as $start = "01:30" for the comparison to be true.

Share this post


Link to post
Share on other sites

I was thinking about digit count, but was unsure without the documentation.

Res has pretty much found the problem for you.

Share this post


Link to post
Share on other sites

@Hour returns in the range 00 to 23.

$start = "1:30" should be written as $start = "01:30" for the comparison to be true.

Bingo!

Thanks for everyones help!

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