>>I had to change the define class line to reportlistener not htmllistener
>>loListener.targetfilename property it doesn't exit.
Since you're are generating an HTML report you need to use the html listener class that's the class that has the targetfilename property in it. Your code was using it when you put the 5 as the parm for the do command.
What error where you getting? I tested that code before submitting and it did run on my system.