theflyingminst
02-17-2009, 11:04 AM
Hi I'm sure this will seem like a silly question to most people but I have to ask..
The below code I found at (http://www.tele-pro.co.uk/scripts/misc/asp_schedule_task.htm)..
Does this have to be called? Like do I need to throw this on my site index page to make sure it's being updated, or is it supposed to run off the server independently without anyone calling the function?
'call AnyFunction() once every 6 hrs
If (ScheduleTask("MyTaskName", "h", 6)) Then
Call AnyFunction()
end If
FUNCTION ScheduleTask(task_name, period, qty)
Dim RunNow
Dim last_date
Dim diff
'boolean result
RunNow = False
'chcek the value of app setting
last_date = Trim(Application("Sched_" & task_name))
'is value empty? maybe app just started
If (last_date = "") Then
RunNow = True
Else
'is value old?
diff = DateDiff(period, last_date, Now())
If (diff>=qty) Then RunNow = True
End if
'if scheduled to run now, set the app last run time
If (RunNow) Then Application("Sched_" & task_name) = Now()
'return result
ScheduleTask = RunNow
END FUNCTION
FUNCTION AnyFunction()
'your code here
END FUNCTION
Thanks so much
The below code I found at (http://www.tele-pro.co.uk/scripts/misc/asp_schedule_task.htm)..
Does this have to be called? Like do I need to throw this on my site index page to make sure it's being updated, or is it supposed to run off the server independently without anyone calling the function?
'call AnyFunction() once every 6 hrs
If (ScheduleTask("MyTaskName", "h", 6)) Then
Call AnyFunction()
end If
FUNCTION ScheduleTask(task_name, period, qty)
Dim RunNow
Dim last_date
Dim diff
'boolean result
RunNow = False
'chcek the value of app setting
last_date = Trim(Application("Sched_" & task_name))
'is value empty? maybe app just started
If (last_date = "") Then
RunNow = True
Else
'is value old?
diff = DateDiff(period, last_date, Now())
If (diff>=qty) Then RunNow = True
End if
'if scheduled to run now, set the app last run time
If (RunNow) Then Application("Sched_" & task_name) = Now()
'return result
ScheduleTask = RunNow
END FUNCTION
FUNCTION AnyFunction()
'your code here
END FUNCTION
Thanks so much