If the script has role editorExtension:
Else:
/*/ role editorExtension; testInternal Au.Editor; r Au.Editor.dll; r Au.Controls.dll; /*/
var doc = Panels.Editor.ActiveDoc;
if (doc == null) return; //all closed
var text = doc.aaaText;
print.it(text);
Else:
print.it(C.LaGetCodeEditorText());
class C {
public static unsafe string LaGetCodeEditorText() {
var w = wnd.find(0, "LibreAutomate", "HwndWrapper[Au.Editor;*");
var c = w.Child("document", "Scintilla");
if (c.Is0) return null; //all closed
const int SCI_GETLENGTH = 2006;
const int SCI_GETTEXT = 2182;
int n = _Sci(SCI_GETLENGTH);
if (n < 1) return "";
using var pm = new ProcessMemory(c, n + 1000, noException: true);
if (pm.Mem == 0) return null;
n = _Sci(SCI_GETTEXT, n + 1, pm.Mem);
return pm.ReadByteString(n);
int _Sci(int message, nint wparam = 0, nint lparam = 0)
=> (int)c.Send(message, wparam, lparam);
}
}