Scripting - How to Display Text in Command Panel

 From:  Michael Gibson
8210.2 In reply to 8210.1 
Hi Bryan, how are you running your script, is it a .js file that is located in the commands folder?

If so you can also make a .htm file with the same base name as your .js file and it will be loaded into the command options area and your script can set values in the UI by accessing it through moi.ui.commandUI which will be the HTML window object of the .htm file.

So for example if your .htm file looks like this, set up with an element that has a id set on it to use as a container:

code:
<html>
	<body class="commandbody">
		<div id="TextContainer"></div>
		
		<moi:CommandDoneCancel/>
	</body>
</html>


Then a command script could set text in that container like this:
code:
#include "WaitForDialogDone.js"

function DoIt()
{
	moi.ui.commandUI.TextContainer.innerText = 'This is some text';
	WaitForDialogDone();
}

DoIt();


You'll need to call a wait function like that so the script doesn't just exit, the UI will be torn down when the command exits.

Hope this helps!

- Michael