How to Insert Standard Function Calls into an Existing Script?

How do I insert the following standard function calls into an existing script?
Toolbar "Operations B L Vertical JEG" CLOSE
Toolbar "Operations B L Vertical JEG" STATE=left

The standard function calls move the toolbar to the left.

The Command object is used to run commands in scripts. Almost every Opus script uses it, so there are loads of examples, but the easiest to find is near the top (after the big comment block) of the default script you get when creating a new script button.

Let me try, again, as I don't yet know JavaScript.

Here is the script and the commented standard function calls I am trying to add:

function OnClick(data)
{
	var cmd = data.func.command;
	var v = DOpus.Listers(0).vars;

	if (DOpus.Listers(0).dual == 0)
	{
		if (v("dualSwap").Exists())
		{
			cmd.RunCommand("Set DUAL=toggle,source,remember");
// Trying to add standard function calls on the next two line			
            cmd.AddLine("Toolbar Operations B L Vertical JEG CLOSE");
            cmd.AddLine("Toolbar Operations B L Vertical JEG STATE=left");
//			
			cmd.RunCommand("Go SWAP");
			v("dualSwap").Delete();
		}
		else
			cmd.RunCommand("Set DUAL=toggle,dest,remember");
                        cmd.AddLine("Toolbar Operations B L Vertical JEG CLOSE");
                        cmd.AddLine("Toolbar Operations B L Vertical JEG STATE=left");			
		if (v("dualSize").Exists())
		{
			cmd.RunCommand("Set DUALSIZE " + v("dualSize").value);
			v("dualSize").Delete();
		}
	}
	else
	{
		if (cmd.sourcetab.right)
			v("dualSwap") = true;
		if (DOpus.Listers(0).dualsize != 50)
			v("dualSize") = DOpus.Listers(0).dualsize;
		cmd.RunCommand("Set DUAL=toggle,dest,remember");	
	}
}

The " cmd.AddLine" call had no effect.

What could I put in its palce that would make this standard function call. Thanks for any direction.

Commands added via cmd.AddLine won't be run until cmd.Run, which isn't being done afterwards.

(Alternatively, you can use cmd.RunCommand like the original script is using for everything. That is a helper which lets you do the common thing of running a single line from a single call, without having to call AddLine and then Run just to run a one-line command. See the docs for more detail.)

You have also lost the quotes around your toolbar names in the commands you have in the script. The Toolbar commands won't work without them. If you need help on how to include quotes inside a Javascript string, see here: