GP SoftwareTwitter
Opus FAQsManualCommandsObjects

Label assignments based on script columns do not work after reloading Opus


#1

I have:
[ul]
[li] added a new column in a script, called Checksum Match[/li]
[li] added a couple of labels, Checksum Match (green background), and Checksum Mismatch (red background)[/li]
[li] set up some Label Assignments so that if the new column is "Yes", it assigns label Checksum Match, and if it is "No" it assigns label Checksum Mismatch[/li][/ul]


If Opus is exited and reloaded, the label assignments do not work. It does not matter if the script column is shown or hidden by default, the behaviour is the same.

The only way I've found to get them to take effect again is to go back into Label Assignments and immediately hit OK.

Here's a lovely video of it gfycat.com/IdenticalUnrulyDodobird

Thanks!
T


#2

It's working OK here.

I edited a script column so it always returns "Yes" for everything:

[code]function OnInit(initData)
{
initData.name = "Newest File Column";
initData.desc = "Columns to show the newest file below each folder";
initData.copyright = "(C) 2014 Leo Davidson";
initData.version = "1.0";
initData.default_enable = false;
initData.min_version = "11.5.2"

var col = initData.AddColumn();
col.name = "NewestFile";
col.method = "OnNewestFile";
col.label = "Newest File";
col.justify = "left";
col.autogroup = true;
col.multicol = true;

}

function OnNewestFile(scriptColData)
{
scriptColData.columns("NewestFile").value = "Yes";
}[/code]

And a label filter that makes things Red if the script says Yes:


And things turn red when I launch Opus.

I recommend putting some DOpus.Output calls into your script to see when it's being called and what it is returning for each file/folder.


#3

Will add debugging and dig a bit deeper, thanks.


#4

I've narrowed it down to a completely different script failing (or something?) during initialisation.

Weirdly I can comment out just one line to get it to work, and the line doesn't make any sense:
col.method = "OnColumnVersion";

Still digging.


#5

Oh, and just doing a "return;" immediately in the OnColumnVersion method itself doesn't fix it!


#6

I'm completely stumped here. I can make the version column work or fail merely by renaming the script!

Calling it "AudaxTextVersion.js" fails every time.

Calling it anything else, e.g. "TextVersion.js" works every time.


#7

Have a look in /dopusdata\ConfigFiles\scriptcolumns.oxc - There might be multiple entries for the script and the filter may be pointing to an old one.

Before editing the scriptcolumns.oxc file, fully exit Opus (via File / Exit Directory Opus).

If you remove any entries in there related to the script, then re-launch Opus, and then delete and re-create the filter, does it start working?


#8

Please note: This isn't actually an issue since I can just call the script TextVersion.js and it works. However, it is intriguing!

There were a lot of repeats in scriptcolumns.oxc, but I'm still getting the problem.

I have done the following:

[ul]
[li] Removed all addins except AudaxVersion (the one that seems to be messing up) and Checksum (the one that is doing the column used for colouring).[/li]
[li] Deleted scriptaddins.oxc & scriptcolumns.oxc while Opus was not running.[/li]
[li] Restarted Opus.[/li]
[li] Deleted the label assignments and re-created them - it works after doing this.[/li]
[li] Restarted Opus.[/li]
[li] Notice the colours aren't showing again.[/li][/ul]

scriptaddins.oxc

<?xml version="1.0" encoding="UTF-8"?>
<scriptaddins>
	<disabled />
	<idmap>
		<script id="{4B9FC47F-AB81-4EAE-8E2D-9D546C1FD43A}" path="AudaxTextVersion.js" />
		<script id="{82A38177-591A-4AAD-A936-886D66549060}" path="Checksum.vbs" />
	</idmap>
</scriptaddins>

scriptcolumns.oxc

<?xml version="1.0" encoding="UTF-8"?>
<scriptcolumns>
	<col id="0" name="Version" script="4B9FC47F-AB81-4EAE-8E2D-9D546C1FD43A" />
	<col id="1" name="ChecksumMatch" script="82A38177-591A-4AAD-A936-886D66549060" />
</scriptcolumns>

The column gets populated but the colouring doesn't work:

Going into Label Assignments and hitting OK fixes it:

And again, just renaming AudaxTextVersion.js to TextVersion.js makes it work every time! I re-deleted scriptaddins.oxc & scriptcolumns.oxc and re-set up the filtering after doing that, just to be sure.

Very odd!