Jump to content

Run Program Scheduler


 Share

Recommended Posts

hey all, i am a definate noob to scripting here. I found this after I was messing with an Andy bot for diablo II and wanted to try my own tweaks.

Below is my attempt to run any file (another .au3 script, or anything else) at a certain time that is specifed. the reason I did it this way is because from what I was seeing, the Run() command doesn't work with other scripts.... which is why I got into autoit in the first place

basically to do things when I am not here :-D

lemme know what you guys thing and post some major improvements to it if you wish (plz!)

Thanks :-D

;Runs Anything at a certain time

#include <Date.au3>

$program = FileOpenDialog("Choose file...","My Computer","All")

$time = InputBox("Time", "What time would you like it to run?" & @CRLF & "hh:mm:ss AM/PM", _NowTime(), "")

$count = 0

while $time > 0 
  if $time = _NowTime() Then
    Send("#r")
    WinWaitActive("Run")
    Send($program & "{Enter}")
    $count = $count + 1
    Sleep(1000)
  EndIf
Wend

One problem I have seen, the script does not end after the program runs, the autoit is still in a tray icon for the script, anyone shed some light as to what is keeping this script alive after the while loop is done?

Link to comment
Share on other sites

;Runs Anything at a certain time

#include <Date.au3>

$program = FileOpenDialog("Choose file...","My Computer","All (*.*)")

$time = InputBox("Time", "What time would you like it to run?" & @CRLF & 

"hh:mm:ss AM/PM", _NowTime(), "")

while 1
  if $time = _NowTime() Then
    Send("#r")
    WinWaitActive("Run")
    Send($program & "{Enter}")
    Sleep(1000)
    ExitLoop
  EndIf
Wend
Exit

Yay I figured out how! I think it was just stuck in the While loop forever or something. I also took out the $count thing because I had no clue what that was supposed to do. Oh, and there was a problem with the filter in the file open dialog and I fixed that too :) Hope it helps. Late for school, talk to ya later!

Link to comment
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
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...