Jump to content

run program after time has changed


Recommended Posts

hi

how can i make something like this:

if the time is changing in $time then a program should be started. and $time is beeing read in an inputbox.

i have no clue how to realilze that, i tryed some variantes but they all didnt work :D

i hope u understand what i mean

it would be very nice if u help me

thx

Link to comment
Share on other sites

What you mean with time?

A specific time like 3pm or what?

--------------------------------------------------------------------------------------------------------------------------------Scripts : _Encrypt UDF_UniquePCCode UDF MS like calculatorInstall programm *UPDATED* --------------------------------------------------------------------------------------------------------------------------------[quote name='Helge' post='213117' date='Jul 26 2006, 10:22 AM']Have you ever tried surfing the internet with a milk-carton ?This is similar to what you're trying to do.[/quote]

Link to comment
Share on other sites

This might work it writes it to a ini and then reads it ever 30 seconds and if it matches the read then it runs the prog, i used most of this code when i made an auto grade checker for my school so if you want it to start up every time u restart then make a shortcut to where ever ur prog is

#include <GUIConstants.au3>
#include <File.au3>
$prog = 0
; == GUI generated with Koda ==
$Form1 = GUICreate("AForm1", 622, 441, 192, 125)
$browse = GUICtrlCreateButton("Browse", 16, 8, 49, 25)
$run = GUICtrlCreateInput("", 80, 8, 161, 21, -1, $WS_EX_CLIENTEDGE)
GUICtrlCreateLabel("Hour", 24, 48, 27, 17)
$time = GUICtrlCreateInput("", 56, 48, 113, 21, -1, $WS_EX_CLIENTEDGE)
$changetime = GUICtrlCreateUpdown($time)
GUICtrlCreateLabel("Minute", 24, 80, 36, 17)
$minute = GUICtrlCreateInput("", 72, 80, 97, 21, -1, $WS_EX_CLIENTEDGE)
$changeminute = GUICtrlCreateUpdown($minute)
$save = GUICtrlCreateButton("Save",72,110)
GUISetState(@SW_SHOW)
While 1
$msg = GUIGetMsg()
If $msg = $browse Then
    GUICtrlSetData($run,FileOpenDialog("Choose what to Run","","Executables (*.exe)"))
    $prog = 1
EndIf

If $msg = $changetime Then
    If GUICtrlRead($time) = 0 or Guictrlread($time) < 0  Then
        GUICtrlSetData($time,24)
    Elseif GUICtrlRead($time) = 24 or GUICtrlRead($time) > 24 Then
    GUICtrlSetData($time,1)
EndIf
EndIf
If $msg = $changeminute Then
    If GUICtrlRead($minute) = 0 or GUICtrlRead($minute) < 0 Then
        GUICtrlSetData($minute,"59")
    ElseIf GUICtrlRead($minute) = 60 or GUICtrlRead($minute) > 60 Then
        GUICtrlSetData($minute,"0")
    EndIf
EndIf
If $msg = $GUI_EVENT_CLOSE then Exit
    
If $msg = $save Then
    If $prog = 0 Then
        MsgBox(0,"Select","Please Select a Program to run")
    Else
        _FileCreate("time.ini")
        $file = "time.ini"
        IniWrite($file,"Config","Prog",GUICtrlRead($run))
    If GUICtrlRead($time) = StringLen(GUICtrlRead($time)) = 1 Then
        IniWrite($file,"Config","Hour","0" & GUICtrlRead($time))
    Else
        If GUICtrlRead($time) = "24" Then
        IniWrite($file,"Config","Hour","00")
    Else
        IniWrite($file,"Config","Hour",GUICtrlRead($time))
        EndIf
    EndIf
    If GUICtrlRead($minute) = StringLen(GUICtrlRead($minute)) = 2 Then
        IniWrite($file,"Config","Minute",GUICtrlRead($minute))
    Else
        IniWrite($file,"Config","Minute","0" & GUICtrlRead($minute))
    EndIf
EndIf
EndIf
    Check()
WEnd

Func Check()
    WHile 1
    If IniRead($file,"Config","Hour","") = @HOUR and IniRead($file,"Config","Minute","") = @MIN Then
        Run(IniRead($file,"Config","Prog",""))
        Exit
    Else
        Sleep(30000)
    EndIf
WEnd
EndFunc
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...