I don't think this is actually any different that what jthi provided, but it LOOKS a little different, because when you open a new window with the << script message, the window is large and honors the preferences you've set (like numbering and embedded log).
By writing the script you want to use within an expr() wrapper, you keep the benefits of all of the color formatting, paren matching, etc. This makes it much easier to write (and if needed, maintain) the script. Then you can use the char(name expr()) combination to convert the script expression to a string, which can be placed into the scriptbox. All that remains is reformatting the script to make it look as you'd expect.
So again, this isn't really different in philosophy from what jthi proposed, but it might look more like what you were expecting, due to the size of the window? If not, then apologies; I believe I unfortunately may have misunderstood what you're after.
Cheers,
Brady
Names Default To Here(1);
myScript = expr(
names default to here(1);
print("hello, world.")
);
nsw = new window("My script", <<script);
nsw[scriptbox(1)] << set text ( char( nameexpr( myScript ) ) ) << Reformat;