Scheduler Agent
This code snippet displays an Agent. The agent is of type Planner. This agent, every 20 minutes, wakes up a check for what has to do. Its job is to prepare an HTML mail to John about the users‘ activities in the system. The initial HTML file that contains the AutoScript is the HISTORY.HTM. The HTML file that produces is the _HISTORY.HTM (after the call to html_processfile). The agent sends this mail only at 11 o‘clock every day.
{...................................................AGENT INFO..............................................}
start_agent_info
AgentName = “Activity_Mailer“
AgentDescr = “Activity information to the John“
AgentLanguage = ““
__timer_interval = 1200 { in seconds }
__is_registered = 0
__delete_on_termination = 0
end_agent_info
{.................................ACTION CODE................................................}
start_action
{............Every day at 11, we send mail about the user‘s activities to John. The mail is in HTML form}
when ( _TraversingHour = 11 ) and ((_CurrentDate_Num > fired_date) or (fired_date = 0)) do
email = “john@kosmosbos.com“
call html_processfile(“HISTORY.htm“)
body = html_gettext(“_HISTORY.htm“)
mail = smtp_create()
call smtp_setbody(mail, body)
call smtp_setcontent(mail, “text/html“)
call smtp_send(mail, “my_smpt“ , “Activities“, “John“, email )
endwhen
end_action