For the TextExpander application, you should also be able to use some variant of the code at the foot of this post:
For more information, see the wiki Searching the Forum for Answers section.