Label Filter Stops Working After Restarting

Only 'Label Filter' Assignment I have active stops working after closing Opus and running it again.

Enabling/disabling the 'Type" clause and confirming makes it work again. It worked okay when I first created it, with only the "Script column" clause.

The script it is using may be getting stuck or returning incorrect results when first run.

Have you debugged what the script is doing at all?

It is a simple script column in a script file by itself. The column works okay in the conditions that the label filter does not - after starting Opus.

We don't have a magic wand we can wave to make things start working again. You'll need to provide some more information.

Sure. What exactly?

You could show us the script. Or maybe as Leo suggested, try debugging it. Put some calls to DOpus.Output in it so you can see when it's being called. If it's not being called at all for the label that might suggest some other label is matching it first, so you could look to see what your other labels are doing.

// Called by Directory Opus to initialize the script.
function OnInit(initData)
{
	initData.name = "Column for Preview's Existence";
	initData.version = "1.2";
	initData.copyright = "AndersonNNunes.org";
	initData.url = "";
	initData.desc = "Column used to indicate if a video file has a matching image preview in a side-car file.";
	initData.default_enable = true;
	initData.min_version = "12.0";

	var col = initData.AddColumn();
	col.name = "HasPreview";
	col.method = "OnHasPreview";
	col.label = "Has Preview";
	col.justify = "left";
	col.autogroup = true;
}

// Implement the HasPreview column.
function OnHasPreview(scriptColData)
{
	if (scriptColData.item.is_dir)
	{
		return;
	}

	var groups = scriptColData.item.groups;

	if (typeof groups != "object")
	{
		return;
	}

	var movie = false;
	
	for (var i = 0; i < groups.count; ++i)
	{
		if (groups(i) == "Movies")
		{
			movie = true;
			break;
		}
	}
	
	if (!movie)
	{
		return;
	}

	var resPath = String(scriptColData.item.realpath);
	var extension = String(scriptColData.item.ext_m);
	var formats = new Array();
	var formatA = resPath + ".jpg";
	formats.push(formatA);
	var formatB = resPath + ".vtx";
	formats.push(formatB);
	var formatC = resPath.replace(extension, ".jpg");
	formats.push(formatC);
	var formatD = resPath.replace(extension, ".vtx");
	formats.push(formatD);
	
	for (var i = 0; i < formats.length; i++) {
		if (DOpus.FSUtil.Exists(formats[i])) {
			DOpus.Output("HasPreview: Yes!");
			scriptColData.value = "Yes";
			scriptColData.sort = 0; // To sort 'Yes' before 'No'.
			return;
		}
	}
	DOpus.Output("HasPreview: No...");
	scriptColData.value = "No";
	scriptColData.sort = 1; // To sort 'Yes' before 'No'.
	return;
}

It is not called after a fresh start. It starts being called after toggling the Label Filter twice and confirming on the Preferences dialog.

These are my label assignments:

Other:

Directory Opus Pro 12.7.1 (Beta) Build 6593 x64
OS 10.0 (B:16299 P:2 T:1) SP 0.0

Looking at the screenshot in your original post, it looks like the value "Yes" may have some leading spaces in it. It would normally be left-aligned, as shown here:

Could that be the problem?

I don't think so.

2018-02-09%2011_51_22-Start

Hmm odd, quirk of the font maybe.

Anyway, when I try this filter here it works ok, even after shutting Opus down and restarting it. So I suspect it's due to an interaction with other filters or scripts you may have.

I want to disable all other scripts to test that. Is it safe to temporarily remove them from the scripts folder? As in, will they keep their current settings once they are back?

If you do a config backup first you won't have to worry about that.

It appears that as long as the script for that column is the only one, the assignment works at every restart, but as soon as any other column script is enabled, it does not.

I tested with the other script being Real Header File Type Extension, among others.

Any more suggestions of alternatives to try to uncover the source of the issue?

In that script, try changing this line:

Do While Not ((blbB(lngI) > 31 And blbB(lngI) < 127) And (lngI < lngMxBlbLen))

to this:

Do While (Not (blbB(lngI) > 31 And blbB(lngI) < 127)) And (lngI < lngMxBlbLen)

Does that fix things? I suspect it was getting into an infinite loop.

No, it did not fix the issue.

As I said, it appears to happen for any column script, including Newest File Column, among others.

Small update on this: now it does not even work after enabling/disabling the filter when other column scripts are enabled.