Display UserCommands overview

I want to use the mouse as few as possible.

Shortcuts are too limited, so I defined some User Commands. They are powerful and accessible within the FAYT-field (Find As You Type) by typing a > into the file display, then the name of the command.

Because I can not remember everything, I wrote a script that parses all User Commands and creates an overview that will be opened with the default application for textfiles (.e.g. notepad).


You need to create some User Commands of your own first, of course. See User Commands in the Opus manual.

Download:

Script Code:

The script code in the download above is reproduced here for reference.

// ****************************************************************************
// Creates an usercommand overview and displays it in the
// default application for *.txt-files 
// ****************************************************************************

function OnClick(clickData) {
 
	var pathDopusData;
	var fileExt;	
	var fso;
	var wshShell;
	var shell;
	var fileNameTemp;
	var fileNameUC;
	var fileStream;
	var fileData;
	var re;
	var label;
	var tip;
	var list = '';

	// Helpers
	wshShell = new ActiveXObject("WScript.Shell");
	shell = new ActiveXObject("shell.application");
	fso = new ActiveXObject('Scripting.FileSystemObject');

	// New Enum
	commandList = new Enumerator(DOpus.Create.Command.CommandList('u'));
	commandList.moveFirst();
	while (commandList.atEnd() == false) {

		// Read the uc-file
		fileNameUC = DOpus.aliases('dopusdata').path + '\\UserCommands\\' + commandList.item() + '.ouc';
		fileStream = fso.openTextFile(fileNameUC);
		fileData = fileStream.readAll();
		fileStream.Close();

		// Get the label
		re = new RegExp('<user_label>(.*?)</user_label>');
		fileData.match(re);
		label = RegExp.$1;

		// Get the description
		re = new RegExp('<tip>(.*?)</tip>');
		fileData.match(re);
		tip = RegExp.$1;

		// Add it to the list
		list += commandList.item() + '\t= ' + label + ' (' + tip + ')' + '\r\n';

		commandList.moveNext();
	}

	// Always use the same file (temp. dir) so don't worry about deleting tempfiles...
	fileNameTemp = wshShell.ExpandEnvironmentStrings('%TEMP%') + '\\_dopususcmd.txt';
	fileStream = fso.CreateTextFile(fileNameTemp);
	fileStream.Write(list);
	fileStream.Close();

	// Display
	shell.ShellExecute(fileNameTemp, "", "", "open", 1);
}

// ****************************************************************************