GP SoftwareTwitter
Opus FAQsManualCommandsObjects

Showing computername in label of Command

Is there a way to show content of environment-var in label of a command.
Asking because I would like to have such a command with the name of my computer. This way I can go to my Computer directly, but what's more important I can look up the name of my computer easily.
I know I can do a ipconfg /all (or someting else) but would be nice to have it in Opus.
The problem is I can't remember the name of my computer because it's generated by IT with some letters and numbers and can't remember.
(tried also with following label-text = 'Computer %COMPUTERNAME%')

You can use env-vars in the commands themselves, but not in the labels for them on the toolbars.

If you just want to display it somewhere, it could be added to the titlebar or the statusbar. Using a script is probably the best way to do that. We can help if you need that.

Or you could have a button which puts it into the clipboard:

Clipboard SET %computername%

Or one which runs goes to the computer's list of network shares:

go \\%computername%

A fast check in the help-system (here in Europe it's after midnight) didn't show me how to use a script to show this kind of information in the title-bar.
So, as you said, show/explain how to do (if not to much work)

Download this and then drag it to the list of scripts in Preferences / Toolbars / Scripts:

Computer Name in Title.js.txt (606 Bytes)

You can edit the 2nd last line to change how the titlebar looks:

function OnInit(initData)
{ = "Computer Name in Title";
	initData.version = "1.0";
	initData.copyright = "(c) 2019 Leo Davidson";
	initData.url = "";
	initData.desc = "Adds the computer name to lister title bars";
	initData.default_enable = true;
	initData.min_version = "12.17";

function OnOpenLister(openListerData)
	var cmd = DOpus.Create.Command();
	cmd.RunCommand('Set LISTERTITLE "notoggle:%T - Directory Opus - %COMPUTERNAME%"');

The %T code turns into the current path (name only). Other codes you can use are listed here under the description of the Custom Title option.

Of course, when the script is installed it will override the Lister Title Bar settings under Preferences / Display / Options.

1 Like

Works like a charm.