Cool, very robust!
Next Thing: Keyboard Shortcut for the Legend
Local( {first_gb},
Try(
first_gb = (Current Window() << XPath( "//OutlineBox[@helpKey = 'Graph Builder']" ))[1] << Get Scriptable Object;
first_gb << show legend (!(Report(first_gb)[LegendBox( 1 )] << get width));
)
);
why "Current Report"?
-> hm, debugging is much easier
Toggling the IfBox value instead of sending the "Control Panel" command to the Graph Builder Object is clever (a whole new world of possibilities!)
Was there a specific reason to go from Report to Scriptable Object and then back to Report?
instead of
Local({first_gb},
Try(
first_gb = (Current Report() << XPath("//OutlineBox[@helpKey = 'Graph Builder']"))[1];
first_gb[IfBox(1)] << Set(!(first_gb[IfBox(1)] << get));
);
);