It isn't really that simple to create a script which would work with any graph/report.
The basic idea could be something like this but this makes already assumptions that you have a reference to the table and the analysis object. It also assumes that all frameboxes are based on the same table
Names Default To Here(1);
dt = open("$SAMPLE_DATA/Big Class.jmp");
gb = dt << Graph Builder(
Variables(X(:weight), Y(:height), Overlay(:sex)),
Elements(Points(X, Y, Legend(9)), Line Of Fit(X, Y, Legend(11)))
);
str = Char(As Date(Today())) || " " || (dt << getname);
fbs = Report(gb) << XPath("//FrameBox");
Eval(EvalExpr(
fbs << Add Graphics Script(
Text Color("Red");
Text(Right Justified, {X Origin() + X Range(), Y Origin()}, Expr(str));
);
));
but figuring out which is the correct table for example can get fairly complicated.
-Jarmo