Saving time with Text Expanders

Here is a nice little tool I found that could help you avoid doing repetitive tasks especially in coding and documenting/emailing. Texter is a stand-alone, text substitution application that resides in system-tray and can run across any application.

Till recently, I preferred WYISYG HTML editors simply because they are faster and easier to use, but then I found that most of these graphical editors including MS Word/MS Frontpage add tags of their own which may not be recognized by other editors. Further, the graphical representation is most often than not found lacking in comparison to the original visualization. That 1 pixel difference may stick out like a sore thumb in the final interface as well as in the code but you might not even notice it when designing visually. Invariably, you end up optimizing and cleaning up the code manually which in itself becomes problematic as the code generated usually contain a lot of redundant lines making them complex and confusing.

But starting from scratch using an editor like Notepad or Textpad can be quite a tedious job and this stands true for every aspect of software development, not just HTML/CSS designing. Text Expander applications can really help you avoid repetitive tasks replacing text snippets for words associated with them. Of the popular text expanders the one that I found nice (as well as free) is Texter, the text substitution application supported byLifehacker which allows you to create a set of text snippets to substitute the words associated with them.

Texter is free and Open Source and you can download Texter installation package , a stand-alone executable and the source code of the applicationfrom Lifehacker

Texter is different from other plugins and add-ons as it resides in the system tray and allows you to substitute text across different applications. You can specify the words and phrases you want to substitute with text snippets usinghotstrings.

Hotstrings are like key/value pairs, the key could be a small word such as “address” and the value would contain the complete postal address. When you type the key on an editor and set the trigger Texter would replace the key with value. In other words, you type “address” and press on tab key, Texter fills your complete postal address for you.

You can create or manage hotsrings through the applications context menu or by using the shortcut keys Ctrl+Shift+H and Ctrl+Shift+M. Let us first create a hotstring to find out how it can help in coding.

Click Ctrl+Shift+H to bring up “add new hotstring” dialog. Since I am usingTextpad to create HTML document the first thing I would require is a skeletal HTML code for the page. So I set “blankHTML” as the hotstring and in the textarea that says “Enter your replacement text here…” add the following code

–
-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

The body text goes here.

In the Trigger option I have checked “Tab“, which means that the when I press tab, the control passes to Texter.

Now when you go back to Textpad, all you need to do is type “blankHTML” and press the tab key. The word “blankHTML” will be replaced with HTML skeletal code as specified. Now in the block below, I am going to type “blankHTML” (without quotes) and press Tab and you can see the result for yourself.

http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd>

 The body text goes here.

You can also use special operators like %| (its pipe) to place the cursor at a point, %c to insert from clipboard, %t for time, %ds for short date (m/d/yyyy) and %dl for long date (Day, Month dd, yyyy)

We have created a bare HTML page, now let us add a script tag to include the script file to the web page.

Add a new hotstring called includejscript and enter the following text

The %| operator indicates that, that is the point where the cursor is inserted. Now go back to the editor and type “includejscript” (without quotes) and press “tab” . Texter replaces substitutes the word with the following and inserts the cursor at the point where the script path and name should be added.

If you are lazy enough to type that much even, you could just copy the script’s path and name and use the “%c” operator to include it.

In this case, if the path of the script you want to add is YUI library’s “logger” script modify the hotstring to use the copied text, copy the path to the clipboard and type “includeloggerjs” + tab. The text generated would automatically include the script tag as well as the “URL“.

Texter should replace the following tag.

Till now we have been using static text but to automate tasks we would need more dynamism. You can use Texter in script mode to automate tasks dynamically. To create a script simply select “script” in the drop-down box while creating or editing hotstrings. All modifier keys on the keyboard can be represented in Texter by simply including their literal name within curly brackets {} except certain modifier keys which are represented by special characters #,!,^,+

#     Windows Key

!     Alt Key

^    Control Key

+    Shift Key

To represent the literal name of these keys simply include them within curly brackets, for instance {HOME}, {UP}, {BS} etc.

Using scripts you can make Texter behave more intelligently and save your time considerably. Deriving from Adam Pash’s video tutorial here let me demonstrate how to use Texter to customize and compose batch emails. In this instance I am composing mail so the first thing I need to do is greet the recipient. The content of the message should be something like the following:

Hi John,

How are you?

Thanks,

Danish Ahmed

Mindfire Solutions

If we take the above message as a standard message to be sent to multiple recipients then only the name of the recipient “John” might need to change, the rest would remain the same. This shouldn’t be difficult since the name of the recipient can be easily copied from the “to” field and pasted in the message body, after “Hi“. We just need to simulate appropriate keystrokes to perform the same action through script. Create a hotstring and name it “WriteMail” or anything else you want. Make sure the dropdown box contains “script“, assign a trigger (I use tab key) and add the following code.

+{Tab}+{Tab}^{Home}^+{Right}^c{Tab}Hi{Tab}Hi ^v, {Enter}How are you? {Enter}%|{Enter}Thanks,{Enter}Danish Ahmed{Enter}Mindfire Solutions.

Now go to your mailbox, click on compose, add sender name (for e.g. John) and go to message body. Type “WriteMail” and press the trigger key (tab in my case). Texter adds “Hi” in the subject field and the full text in the message body and places the cursor in the line next to the “How are you?” line.

Hi John,

How are you?

|

Thanks,

Danish Ahmed

Mindfire Solutions

Note: This code works with mailboxes accessed through Web browsers (GMail), Mail clients including Outlook Express have the “cc” field enabled, so you need to add extra +{Tab} to go to “to” field and another {Tab} to go back to message body.

Now, saving a few keystrokes may not look like big deal but when you look at  the cumulative effect, you could end up saving a lot of time. Also,the amount of time you save would also depend upon how innovatively you have used the tool. And as an added benefit, you are likely to make less syntatical errors or spelling mistakes!

Texter is free and for Windows only but it is not the only application that offers these features, there are many other text expanders to chose from.ActiveWords is one of the most popular text expanders for Windows, on Mac you can use  TextExpander or FastFox  (which works on both Windows and Mac OS).  Breevy is another text expander for Windows which provides additional features in the form of ability to import and sync, your existing TextExpander snippets and use them in your Windows box.  

150 150 Burnignorance | Where Minds Meet And Sparks Fly!