function OnActivateLister(activateListerData)
{
var cmd = DOpus.NewCommand;
var closid = activateListerData.lister;
DOpus.output(closid);
cmd.SetSourceTab(closid.activetab);
cmd.RunCommand("Set JOBSBAR=on");
}
Script works but few strange things happens.
First:
Error at line (...)
Error 0x80004005
This line is "cmd.SetSourceTab(closid.activetab);"
But that error just shown sometime, not always.
Second - when I activate lister, DOpus.output shows me two lister id (source and destination). I remind that I'm using single listers, so onActivateLister should return me one ID. But onActivateLister returns destination lister ID too (the one I didn't activate). Or, to be more precised, procedure is activated twice - once for source lister, second time for destination.
More debug outputs and I figure out that problem is when I open new lister when there is no destination lister open but just other inactive or not listers at all.
cmd.SetSourceTab(closid.activetab); <- this command makes bug, because Opus activates script twice for two different lister ID, even if it's only one opened.
PS. I added condition: if (closid.state!="" && closid.state!="0")
This resolved my problem with error but I think there is small bug in DO. Script should be activated only for one lister.
And still Opus can sometimes return error:
Error at line xx, position 1
Error 0x80004005
function OnActivateLister(activateListerData)
{
var cmd = DOpus.NewCommand;
var closid = activateListerData.lister;
if (closid.state!="" && closid.state!="0"){
cmd.SetSourceTab(closid.activetab);
cmd.RunCommand("Set JOBSBAR=on");
}
}
This is line that returns error: "cmd.SetSourceTab(closid.activetab);"
Try debugging it by printing (DOpus.Output) closid, then closeid.activetab before the SetSourceTab line. When it fails, see what each printed as and it might shine a light on where things are failing.
Ok, I added debugs and when I saw error again - I'll check it.
But my question was - is this a bug that OnActivateLister is called twice every time I activate lister? Or even if I click desktop?
Now by debugged script looks like that:
function OnActivateLister(activateListerData)
{
DOpus.output("----start----");
var cmd = DOpus.NewCommand;
var closid = activateListerData.lister;
if (closid.state!="" && closid.state!="0"){
DOpus.output("id: " + closid);
DOpus.output("state: " + closid.state);
cmd.SetSourceTab(closid.activetab);
cmd.RunCommand("Set JOBSBAR=on");
}
DOpus.output("----end----");
}
And it shows when I click on desktop (after I clean log):
----start----
id: 463696
state: 1
----end----
If I open second lister and click, it returns:
----start----
----start----
id: 463696
state: 2
id: 1115962
state: 1
----end----
----end----
If is more than 2 listers then it returns source and destination lister only, not all of them.
I waiting with patience for new beta and I see there is no fix. I can wait more if someone can answer me at least is this a bug and if yes - is someone fix that.
I noticed that many times here answers are inconclusive - people spoke about bugs, improvements etc. and conversation ends without any conclusion. So I don't know anyone fix this problem, or improve image resizing, or fix copy dialog problem (steal focus) etc. Just few questions about provide more details and conversation breaks off.
OnActivateLister fires for both the Lister gaining activation and the one losing it, so seeing it fire twice is not unusual. You can use the ActivateListerData.active property to see which action you're being called for.
function OnActivateLister(activateListerData)
{
var cmd = DOpus.NewCommand;
var closid = activateListerData.lister;
var closidx = activateListerData.active;
if (closidx==true){
cmd.SetSourceTab(closid.activetab);
cmd.RunCommand("Set JOBSBAR=on");
}
}