I'm offering the LT code below as a method of providing helpful legend formatting token hints for the Legend Update dialog. It's not sophisticated but does the job. The tokens are based on Origin9.0.0 SR2 so if you have an earlier version, you might need to modify them.
You can put the script in a menu item or toolbar button with this code:
run.section(myscriptfilename.ogs, mylegendupdate);
Here's the script:
// Labtalk wrapper for legendupdate X-Function. Displays formatting tokens in the classic script window
[mylegendupdate]
// Clear script window (optional- may comment out)
type -o new;
// Type tokens to classic script window
type -a "Legend Formatting Tokens";
type -a "========================";
type -a "@C => Column short name.";
type -a "@D => Dataset name.";
type -a "@LA => Long Name, if available, else Short Name.";
type -a "@LC => Comment.";
type -a "@LD<n> => User Parameter. @LD is the same as @LD1, but in order to use @LD2, you will need at least two user defined parameters.";
type -a "@LG => Long Name, if available, else Short Name and Units.";
type -a "@LH => Header (entire header) (NOT CURRENTLY IMPLEMENTED!).";
type -a "@LL => Long Name.";
type -a "@LM => Comments (first line), if present, or Long Name, if present, else Short Name.";
type -a "@LN => Equivalent to @LM + @LU.";
type -a "@LP<n> => Parameter; @LP is the same as @LP1. In order to use @LP2, @LP3, you will need those Parameter rows shown in the worksheet.";
type -a "@LQ<n> => The legend will show the User Parameter + [@LU].";
type -a "@LS => Short Name.";
type -a "@LU => Units, not including Long Name, and without brackets [] or parentheses( ).";
type -a "@R => Full range string.";
type -a "@U => Equivalent to @LG (previous notation).";
type -a "@W => Book Short Name.";
type -a "@WL => Book Long Name.";
type -a "@WS => Sheet name.";
// Clear selections on page
page -s;
// Active first layer
page.active = 1;
int isCancel;
// Open legendupdate X-Function dialog with isCancel switch
legendupdate -dc isCancel;
// Optional legend positioning code (example below)
/*
if (isCancel == 0)
{
legend.x = layer.x.to - (legend.dx/2);
legend.y = layer.y.to - (legend.dy/2);
}
*/
// Clear script window (optional- may comment out)
type -o new;
// Hide script window
type -h;
return (isCancel == 0);
// End section