New object DOpus.State

Return True if DOpus is started, and False otherwise.
Like a variable set via OnStartup event.
If I load the script after Opus starts, the script does not run because the startup event only runs after startup, unless I use two scripts. . .So a new object is better.

I'm not sure this will do what you want it to, since listers may open both before and after that point.

I probably don't understand what you need to avoid using a flag/event, but using OnOpenLister (which scripts can use to be notified both before and after the initial folder tabs are read) and a variable set on the lister may be a good way to do things, if the aim is to track changes to listers but only after they've opened.

1 Like

OnOpenLister event is even better!

// Called by Directory Opus to initialize the script
function OnInit(initData)
{ = "Test";
	initData.version = "1.0";
	initData.copyright = "(c) 2023 Ken";
//	initData.url = "";
	initData.desc = "";
	initData.default_enable = true;
	initData.min_version = "13.0";


// Called when a new Lister is opened
function OnOpenLister(openListerData)
    if (!openListerData.after)
	    return true
    DOpus.Output("The tabs of the lister have been opened")
	openListerData.Lister.Vars.Set("exec", 0);

// Called when a tab is activated
function OnActivateTab(activateTabData)
    var Lister = activateTabData.newtab.lister;
	if (!Lister.Vars.Exists("exec")) return;
	DOpus.Output("Activate tab")