scheduler error

Executing a scheduler.addJob(name, datetime, global.method) does two things:

  • the attached global.method gets executed right away;
  • an error message is shown (see attachment);

OS X 10.3.1, Sv2.0B4

i don’t thing you do this:

scheduler.addJob(name, datetime, global.method)

but you do this:

scheduler.addJob(name, datetime, global.method())

then yes the global method is executed right away.
And that method doesn’t return a value so the method addJob with a string, date, function params doesn’t work for string,date,NOTHING.

OK, I understand now. I have to leave the parenthesis away and just did that. It works again but now what about being able to add variables. Do I do that like your reply to my question by adding an array?

Can you give me an example?

like this should work:

plugins.scheduler.addCronJob(‘20mins’,‘0 0/20 * * * ?’,globalMethod,new Array(‘it2be’,‘marcel’))
plugins.scheduler.addCronJob(‘23:30’,‘0 30 23 ? * *’,globalMethod,dateNow,date5Days,new Array(‘it2be’,‘marcel’))

OK got that working for me. And now, how do I get back that array data?

that global method will be called with that argumetns array.

so in that global method you can do this:

var firstArg = arguments[0];
var secondArg = arguments[1];

ok I understand so instead of global.method(‘it2be’,‘marcel’) I do global.method, new Array(‘it2be’,‘marcel’)…

Thanks Johan and have a nice weekend…[/code]