How to create new windows at run time

Can one create a new window on the fly? i.e. can one have a “create new window” button that creates a new window at run time?
If so is this the right call for ObjectiveC

  • (NSRect)contentRectForFrameRect:(NSRect)windowFrame styleMask:(NSUInteger)windowStyle
    and finally how is it implemented in ApplescriptObjC?
    Thanks

You use either -initWithContentRect:styleMask:backing:defer: or -initWithContentRect:styleMask:backing:defer:screen:. The arguments it takes should be fairly obvious.

thanx