There are some placeholders you can use in your user-defined tags: %C, %B, %M, %E, %R and %T.
%C: this is where the cursor will be placed after the insertion of a user-defined tag.
%B: will be replaced by a bullet (see Bullets).
%M: will be replaced by the selected text.
%E: denotes the indentation depth of text inside an environment.
%R: will call a reference-dialog to choose a label which has already been defined. This can be used to refer to a predefined label, which you can choose from a drop-down list (see also → → or → → ).
%T: will call a citation-dialog to choose an already defined cite. Like using → → a list with all the citation keys pops up.
Let's consider another example, with a macro like \frac{%M}{%C}. First, we select a number in our text, let's say 42.
Now we invoke this macro and obtain \frac{42}{} with the cursor located within the second pair of brackets.
If you want to insert the contents of a text file, you could use the same placeholders.
If you want to execute an external program, only the %M for selected text is recognized in the command line. The selection will be saved in a temporary file and the placeholder %M is replaced with this filename.

Another placeholder is %S, which is replaced by the complete base name of the current document without the path. This base name consists of all characters in the file up to (but not including) the last '.' character.