Month (Modified) Column

Overview:

This script adds a column which shows just the month component of the Modified timestamps:

This lets you sort, group or search based on the month files and folders were last modified.

For example, you might want to find all accounting documents between June and August on any year, or all of your photos from December in any year.

Installation and Usage:

Requires Directory Opus Pro 12.0 or above.

  • Download: Month_Column.js.txt (904 Bytes)
  • Open Settings > Preferences / Toolbars / Scripts.
  • Drag Month_Column.js.txt to the list of scripts.

A new column will now be available:

  • Script > Month (Modified)

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.

This command will add the column and then sort by it:

Set COLUMNSADD="scp:Month Column/MonthModified"
Set SORTBY="scp:Month Column/MonthModified"

To use the column for searching, use Tools > Find Files, select the Advanced tab, and set up one or more Script column clauses to match (or exclude) the months or month ranges you are interested in:

History:

1.0 (08/Jan/2018):

  • 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.

// This is a script for Directory Opus.
// http://www.gpsoft.com.au/DScripts/redirect.asp?page=scripts

function OnInit(initData)
{
	initData.name = "Month Column";
	initData.version = "1.0";
	initData.copyright = "(c) 2018 Leo Davidson";
	initData.url = "https://resource.dopus.com/t/month-modified-column/27727";
	initData.desc = "A column which displays just the month without the day or year.";
	initData.default_enable = true;
	initData.min_version = "12.0";

	var col = initData.AddColumn();
	col.name = "MonthModified";
	col.method = "OnColumn";
	col.label = "Month (Modified)";
	col.header = "Month";
	col.justify = "right";
	col.defwidth = 6;
	col.autorefresh = 1;
	col.autogroup = true;
	col.type = "number";
}

function OnColumn(scriptColData)
{
	if (scriptColData.col != "MonthModified")
		return;

	scriptColData.value = scriptColData.item.modify.month;
}

A post was merged into an existing topic: How to filter for certain months in a folder?