Product Version (matching File Explorer)

Overview:

Opus has a built-in Product Version column, but there are situations where it shows different information compared to the similar column in File Explorer.

The differences are because EXE and DLL resources contain multiple copies of both the Product Version and Module Version in different formats and languages. Opus always goes to the binary version (which only exists once per file) and uses that. File Explorer instead uses a string version matching the current language (or the best one it can find).

If the two versions are different (other than additional information which can be in the text field), it's a translation error in the EXE or DLL. You could also have a situation where the translated string for English is a completely different number to the one for German, and Swedish had yet another number. File Explorer can thus show different version strings in different languages.

This is discussed in more detail here:

You can't do much about how version information is stored in someone else's EXE or DLL, so sometimes you might need what File Explorer shows. You can show that in Opus as well.

Opus 13: No script required.

If you're using Opus 13 (or above), no script is required.

Go to Preferences / File Display Columns / Shell Properties and turn on File Explorer's version columns in Opus.

Use the filter below the column list to find them quickly, as shown here:

The added fields can then be found in the "Shell" category in most places that deal with columns/fields within Opus.

Older versions of Opus:

This script below imports the Product Version column from File Explorer so you can see the same thing in Opus. (The normal Product Version column isn't replaced, so you can show both things side-by-side if you wish.)

This is essentially the old way of doing what the UI above for Opus 13 makes easier now.

Installation and Usage:

Tested with Directory Opus Pro 12.20.

  • Download: Shell Product Version.js.txt (940 Bytes)
  • Open Settings > Preferences / Toolbars / Scripts.
  • Drag Shell Product Version.js.txt to the list of scripts.

A new column will now be available:

  • Script > Product version

(The exact name may differ, depending on language. The translated name comes from Windows.)

You can display, sort and group using the column the same as you would normal built-in columns. For example, right-click the column header, or use the Folder Options dialog.

You can also refer to the column in commands which you can place on toolbar buttons, menu items, hotkeys, etc, as well as search using Tools > Find Files > Advanced, and add it to Info Tips via Settings > File Types.

Script history:

1.0 (22/Apr/2020):

  • Initial version.

Script code:

The script code from the download above is reproduced below. This is for people browsing the forum for scripting techniques. You do not need to care about this code if you just want to use the script.

function OnInit(initData)
{
	initData.name = "Shell Product Version";
	initData.version = "1.0";
	initData.copyright = "(c) 2020 Leo Davidson";
	initData.url = "https://resource.dopus.com/t/product-version-matching-file-explorer/35266";
	initData.desc = "Import the Product Version column from File Explorer";
	initData.default_enable = true;
	initData.min_version = "12.0";

	var props = DOpus.FSUtil.GetShellPropertyList("System.Software.ProductVersion", "r");
	if (props.count == 1)
	{
		var prop = props(0);
		var col = initData.AddColumn();
		col.name = "ShellProductVersion";
		col.method = "OnShellProductVersion";
		col.label = prop.display_name;
		col.justify = "left";
		col.autogroup = true;
		col.autorefresh = 1;
		col.userdata = prop.pkey;
		col.type = "string";
	}
}

function OnShellProductVersion(scriptColData)
{
	scriptColData.value = scriptColData.item.shellprop(scriptColData.userdata);
}
3 Likes

Great script as always, Leo!

I would just like to add that this is not always the case, as some Windows application developers use the file/product version string to show a more human-readable file/product version number in Setup.exe installers for their applications. For instance, you could have in binary data a product version like 0.9.6.0, and 0.96 (alpha) in the string version for the English language (and/or the rest of localized product version strings, if there are more of them).

The "(alpha)" in the string form adds some extra information, which is fine (although I'd personally put it in a different field), but 0.9.6.0 and 0.96(.0.0) are completely different version numbers so I'd call that a translation error.

Well, you are right in this specific example I've written, and it's true that some developers don't use well these major/minor version stuff and this is strictly a translation error.

It could have been 0.96.0.0 in binary form, and 0.96 (alpha) in string form, though :wink:

The thing is now we can get whichever version we want in Directory Opus with this script, so that's great.

1 Like