In Tools -> Tool Properties -> Macros, there is no $Selection Macro to access the currently selected text in the Code Editor.
The only macro to access content from the Code Editor is $CURTOKEN, which accesses the word at the caret position.
Or is there a Macro to access the selected text?