Scripting - Counting tabs in OnStartup() bug

on startup each open tab sends an OnAfterFolderChange() event,
it is not possible to count these open tabs in OnStartup() using

var total = 0;
for(var lister_objects = new Enumerator(DOpus.listers); !lister_objects.atEnd(); lister_objects.moveNext())
	for (var tab_collections = new Enumerator(lister_objects.item().tabs); !tab_collections.atEnd(); tab_collections.moveNext())
	{
		total++;
	}
DOpus.Output(total);

it returns erroneous results.

using the same code in the ad-hoc script editor gives the correct result.

The reason someone might want to do this is to return early in the OnAfterFolderChange() event handler for each open tab.

That's not really a bug. OnStartup runs when Opus starts, and the windows and tabs may not all be open yet, and maybe not even have started opening yet.