Duplicate a Script Editor Tab

Hello.

I can’t find any information on how to write a script that would allow me to create a duplicate of the tab that is currently active in the Script Editor.

In other words, it would be equivalent to

  • Copying the contents of the active tab in the Script Editor

  • Simulating a click on the ‘+’ button to the right of the tab title [this creates a new empty tab] (this is the real challenge)

  • Pasting the contents from the clipboard

I’d be grateful for any help in advance.