running a internet macro at a given time
Author |
Message |
Thuged_Out_G
|
Posted: Thu Jun 01, 2006 11:25 am Post subject: running a internet macro at a given time |
|
|
Im creating a program to run an internet macro at a certain time. The time is either inputted by the user, Or set staticly within the program. I havent done much testing on it so far, Would just like some opinions on things that might cause issues, Or suggestions on aspects that could be improved. Thanks in advance.
code: |
var dir : string
var choice : int
put "Enter full path to macro you wish to run: " ..
get dir : *
proc SysTime
loop
loop
var times := Time.Date
var minutes : array 0 .. 4 of string
for i : 14 .. 18
minutes (i - 14) := times (i)
end for
exit when minutes (0) = "2" and minutes (1) = "0" and minutes (3) = "5" and minutes (4) = "5"
end loop
if not Sys.Exec (dir) then
put "Macro call failed"
put "Error: ", Error.LastMsg
else
put "Macro call complete"
end if
end loop
end SysTime
proc UserTime
var timeInput : string
var times : string
var minutes : array 0 .. 4 of string
put "Enter the time you wish to use, formatting is critical. If you want to execute a macro at x:01:55 then enter 0155. 01 being the minutes and 55 being the seconds, Enter the time now: " ..
get timeInput
loop
loop
times := Time.Date
for i : 14 .. 18
minutes (i - 14) := times (i)
end for
exit when minutes (0) = timeInput (1) and minutes (1) = timeInput (2) and minutes (3) = timeInput (3) and minutes (4) = timeInput (4)
end loop
if not Sys.Exec (dir) then
put "Macro call failed"
put "Error: ", Error.LastMsg
else
put "Macro call complete"
end if
end loop
end UserTime
put "Would you like to input your own time to run a macro, Or would you use the predefined x:21:55?"
put "(1) Use my own"
put "(2) Predefined"
get choice
if choice = 1 then
UserTime
elsif choice = 2 then
SysTime
end if
|
|
|
|
|
|
|
Sponsor Sponsor
|
|
|
zylum
|
Posted: Thu Jun 01, 2006 11:37 am Post subject: (No subject) |
|
|
the outter loop in both procs is unnecessary. that loop will cause the 'macro' to be executed many times untill the time differes from the required time. so it will be executed continuously for a minute. |
|
|
|
|
|
Thuged_Out_G
|
Posted: Thu Jun 01, 2006 10:33 pm Post subject: (No subject) |
|
|
It runs continously throw the first loop, Exits when the time is x:21:55, At which point the macro will be run. Odds are, When it evaluates the exit statement next time the last element in the array isnt going to be still holding the value "5" |
|
|
|
|
|
|
|