To open a new Script Editor window with text selected in another application:

In an application that supports services, select the text you want to open in Script Editor.

Choose the application menu >Services > Script Editor > Make New AppleScript.