How can I see what my opus scripts resolve to?

I often use the echo command and put the pause command at the end to keep the window open. (Fewer characters to type but not that different to what you're doing.)

lxp's dopusrt /argsmsgbox method is better sometimes as it supports unicode strings (DOS Batch can't) and gives the exact arguments (sometimes DOS Batch / echo processes special characters, although it's rare). Only problem is I can never remember the "argsmsgbox" part (despite being the one who chose the name!) and it's a pain to type every time.

This prompted me to write a little script that adds a command you can use to do things a bit easier, with less to remember. I haven't tested it much yet:

  • Out Command.js.txt (1.1 KB)
  • Download it and drag it to Preferences / Toolbars / Scripts.

Script code for reference (same as the download above):

function OnInit(initData)
{
	initData.name = "Out Command";
	initData.version = "1.0";
	initData.copyright = "(c) 2020 Leo Davidson";
	initData.url = "https://resource.dopus.com/t/how-can-i-see-what-my-opus-scripts-resolve-to/34948/4";
	initData.desc = "An \"out\" command to help debug command-line arguments.";
	initData.default_enable = true;
	initData.min_version = "12.0";

	var cmd = initData.AddCommand();
	cmd.name = "Out";
	cmd.method = "OnCommandOut";
	cmd.desc = "Prints arguments into the Utility Panel window.";
	cmd.label = "Out";
	cmd.template = "C/R,O/R";
	cmd.hide = false;
	cmd.icon = "script";
}

function OnCommandOut(scriptCmdData)
{
	var args = scriptCmdData.func.args;

	var cmd = scriptCmdData.func.command;
	cmd.deselect = false;

	var str = "";

	if (args.got_arg.c)
	{
		DOpus.ClearOutput();
		str = args.c;
	}
	else if (args.got_arg.o)
	{
		str = args.o;
	}
	else
	{
		str = "Add C (clear and output) or O (output only) before the other arguments.";
	}

	DOpus.Output(str);
	cmd.RunCommand("Set UTILITY=OtherLog");
}

One caveat is commands with < characters may be interpreted by the Script Log as trying to use HTML-like codes (for bold, font color, etc.). But using that character is quite rare in commands you'd usually run from an Opus button, so hopefully it's never an issue.