How AutoScript Supports Intelligent Agent Technology
We implement the Intelligent Agents in Mykosmos/BOS using AutoScript as well. To support this technology, AutoScript implements some extra keywords and constructs to do the job.
start_agent_info...end_agent_info
We use them to define the basic elements of the agent. For example:
start_agent_info
AgentName = “first_agent“
AgentDescr = ““
AgentLanguage = ““
__timer_interval = 0{....define (in seconds) the timer interval for the wake up}
__is_registered = 1{.....1=the agent keeps trail to database, 0=starting without trail}
__delete_on_termination = 0{....1=the agent frees itself when terminates its task}
end_agent_info
start_action...end_action
They include the code that executes when the agent is activated.
{....................................ACTION CODE..............................................}
start_action
callwait bpm_assign_job (“do job one“,“John“,““)
callwait bpm_assign_job (“do job two“,“Peter“,““)
callwait bpm_assign_job (“do job three“,“Matthew“,““)
end_action
start_bpm_activity...end_bpm_activity
start_bpm_subactivity...end_bpm_subactivity
start_bpm_validation...end_bpm_validation
We use those keywords to define user activities. They include the code of the agent executed on the client-side. For example:
start_bpm_activity “New Request“
start_bpm_subactivity “Define new request‘‘s elements“
rec = bpm_getrecid()
if rec = 0 then
call OpenFormModal(“ptAppend“,“REQUEST02.FM“,“WORK.REQUEST“,1,“?=REQUEST“)
else
expr = strcat(rec,“=REQUEST“)
call OpenFormModal(“ptEdit“,“REQUEST02.FM“,“WORK.REQUEST“,1,expr)
endif
end_bpm_subactivity
start_bpm_validation
result = 1
rec = bpm_getrecid()
if rec = 0 then
call message(“Order does not defined!“)
result = 0 {....do not return to server}
endif
end_bpm_validation
end_bpm_activity
We can have any number of start_bpm_subactivity...end_bpm_subactivity into a user‘s activity.
callwait
That is used only for bpm_assign_job and agent_run. The agent action code does not continue until those procedures are returned control to the agent. For example:
callwait bpm_assign_job (“do job one“,“John“,““)
callwait agent_run(ag)
split_in_branches...and_branch...join_branches
We implement parallel splinting in the following example.
split_in_branches
callwait bpm_assign_job (“do job one“,“John“,““)
and_branch
callwait bpm_assign_job (“do job two“,“Peter“,““)
and_brach
callwait bpm_assign_job (“do job three“,“Matthew“,““)
join_branches
a = 10
We will execute the command (a = 10) only after John, Peter, and Matthew finish their activities. In this example, we know the number of parallel splits of the code in advance. Therefore, we have the following construct in cases where the number of parallel splits we define by code (x).
split_for...next_branch
We use this type of parallel splinting when we do not know the number of splits in advance. For example:
split_for i = 1 to user_count
callwait bpm_assign_job (“do your job“,user[i],““)
next_branch
a = 10
We will execute the command (a = 10) only after user_count jobs are assigned to those users and then return finished by them.