Dear Folks
,
I would like to write a global asa file (as below) and hope it would initiate itself (without visiting the site) automatically to perform a routine data retrieval from the DB and write it in a mail for making a routine data report via e-mail. As I finished the programming, I tested it and found that it only initiated once and send the e-mail as I wish to my a/c but it did not perform the task routinely
..would any expertise here help and modify my coding? Many Many thanks
My main cocern is 1) the script can starts itself in IIS (I have checked the setting in IIS and make it right 2) the script can peform the task routinely
My coding
<SCRIPT LANGUAGE=VBScript RUNAT=Server>
Sub Application_OnStart()
Do While not isNull(application("te_todaysDate"))
' CONFIGURATION OPTIONS
' Description: Set the frequency by setting the execution_feq equal to D or H
'
execution_feq = "H" ' D = Execute Code Once Daily
' H = Execute Code Once Hourly
on error resume next
if UCase(execution_feq) = "H" then
' GET THE TIME IN LONG FORMAT, GRAB THE HOUR
my_time = FormatDateTime(now(),vblongtime)
my_time2 = instr(CStr(my_time),":")
my_time = Left(my_time,my_time2-1)
' IF THE APPLCIATION VARIABLE IS EMPTY INITIALIZE IT AND EXECUTED THE CODE
if isNull(application("te_todaysDate")) then
' execute function/code
**my e-mail script**
application.lock
application("te_todaysDate")=my_time
application.unlock
end if
' IF THE APPLCIATION VARIABLE IS NOT EQUAL TO TODAYS DATE EXECUTE CODE
if application("te_todaysDate") <> my_time then
' execute function/code
**my e-mail script**
application.lock
application("te_todaysDate")=my_time
application.unlock
end if
end if
Loop
End Sub
</SCRIPT>