I’ve noticed some people are visiting this blog looking for code that runs multiple jobs, so here’s a job that does just that.
static void KlFor_runMultipleJobsContainer(Args _args)
{
#AOT // macro for treenode paths
Container jobCont; // container for jobs
int i; // counter for loop
;
// add jobs to the container
jobCont = conins(jobCont, conlen(jobCont) + 1, "klforjob2");
jobCont = conins(jobCont, conlen(jobCont) + 1, "klforjob3");
jobCont = conins(jobCont, conlen(jobCont) + 1, "klforjob2"); // run klforjob2 again
// loop all elements of the container
for(i = 1; i <= conlen(jobCont); i++)
{
// check if the job exists to avoid errors
if(TreeNode::findNode(strfmt(#JobPath, conpeek(jobCont, i))))
{
// run job
TreeNode::findNode(strfmt(#JobPath, conpeek(jobCont, i))).AOTrun();
}
}
}
{
#AOT // macro for treenode paths
Container jobCont; // container for jobs
int i; // counter for loop
;
// add jobs to the container
jobCont = conins(jobCont, conlen(jobCont) + 1, "klforjob2");
jobCont = conins(jobCont, conlen(jobCont) + 1, "klforjob3");
jobCont = conins(jobCont, conlen(jobCont) + 1, "klforjob2"); // run klforjob2 again
// loop all elements of the container
for(i = 1; i <= conlen(jobCont); i++)
{
// check if the job exists to avoid errors
if(TreeNode::findNode(strfmt(#JobPath, conpeek(jobCont, i))))
{
// run job
TreeNode::findNode(strfmt(#JobPath, conpeek(jobCont, i))).AOTrun();
}
}
}
Easy enough :).