Wednesday, January 30, 2008

Automatically correct spelling mistakes

Wouldn't it be nice if an application corrects the spelling mistakes you make regardless of whether you're using a word processor, a mail reader, editor or any application? I use AutoHotkey, an application that I wrote about in this blog earlier, in conjunction with a script. After installing AutoHotkey, go and download the autocorrect script for AutoHotkey. Save it in separate scripts directory and double click it so that a green icon with an H appears in the status bar at the bottom right part of your screen.

Once you do that, try typing the following in an text editor or a word processor:

teh july agin alot aparent wasnt tomatos totaly

You'll find that all the above words are automatically corrected regardless of the application you are using.

The script also includes functionality of adding your own Autocorrect entries.
Just select the word that you often type wrongly, press Win key + H and enter your correction. The entry will be appended to the existing list of entries. Have fun and no more typos!

Saturday, January 26, 2008

Creating simple scripts to automate tasks

Introduction to AutoHotkey

Today, I'll introduce you to a useful scripting program that automates various tasks and assists me in working work faster and more efficiently. I recommend AutoHotkey, a free open source utility for Windows.

What can you do with it? Here are some of its prominent features with which you can:

a) Send keystrokes and mouse clicks

b) Create hot keys for keyboard and mouse

c) Create macros by hand or by using an auto-recorder

d) Expand abbreviations as you type.

e) Automatically correct typos that you often make

f) Convert any script you make into an executable file.

g) Launch programs

It has many other advanced features that may even help you to write an application too, if you wish. I generally use some of the basic features above to create simple scripts. There are libraries of scripts that have already been created, which you can download freely and use.

Here are examples illustrating the use of AutoHotkey features.

First download AutoHotkey and install it.

Let's create a small script to open Notepad and run various commands.

1. Open Windows Explorer and navigate to a folder of your choice.

2. Pull down the File menu and choose New >> AutoHotkey Script (or Text Document).

3. Type a name for the file, ensuring that it ends in .ahk. For example: Test.ahk

4. Right-click the file and choose Edit Script.

5. On a new blank line, type the following (or copy from the line below. All lines beginning with a semi-colon are comment lines.):


;Use the Windows key + N to launch Notepad

#n::Run Notepad

; If you type "br" without quotes, it will be expanded.

::br::With best regards,{ENTER}Sincerely yours{ENTER}

; Corrects all word endings with "bilty" such as "abilty" to ability"


;Opens your browser and launches the Honyaku archives when you press the Win key and space.


;Launches Word when you press the Win key and W.

#W::run winword.exe

;If you have a sequence of operations, you need to end the script using Return.



If you save the script above as Test.ahk and double click on it, you'll see an icon indicating that the AutoHotkey script is active. You will now be able to do the following:

1. Launch Notepad, open the Honyaku archive and launch MS Word and by pressing the Win key + N, Win Key + space and Win key + W respectively.

2. Type br and have it expanded to:

With best regards,

Sincerely yours

3. Automatically correct all words you have mistakenly typed ending with "bilty" to "bility" (such as abilty -> ability)

Try the above after you have run the Test.ahk script.

You can start with the simple script above keep adding programs/URLs to launch, abbreviations to expand (for instance, a complete template of a letter to client), autocorrect entries (all words that you tend to frequently mistype, such as teh->the) and so on. The more abbreviations and autocorrect entries you add, the lesser you type and the faster your output.

Friday, January 18, 2008

Some small macros to ease repetitive tasks

Here are a few macros that I use to eliminate repetitive tasks. Note that I have recorded all these macros in MS Word 2003 (11.9134, SP2), and am releasing them here in good faith – it goes without saying that you use them at your own risk (not that I think they are risky in any way ) I do not write macros for a living; I just record and use them; so I'm sure there are better ways of writing and optimizing them. Should you wish to share small macros that you use with others, post them to me at honyakushaatgmaildotcom (after changing the "at" to its usual symbol, and replacing "dot"; you know what I mean), and I'll reproduce them here for the benefit of all.

1. Convert to lower case

Select phrase/sentence/sentences and run the macro.

Converts a sentence with upper case characters or title case characters to lower case characters.

Ex. QUICK BROWN FOX DIDN'T JUMP BUT HE DID HOP => quick brown fox didn't jump but he did hop

Here's the macro:

Sub ChangeToLowerCase()


' Changes UPPER CASE and Title Case to lower case characters

' Macro recorded 2007/08/28 by Gururaj Rao

Selection.Range.Case = wdLowerCase

End Sub

2. Convert to title case

Converts sentence or phrase to Title Case.

Select phrase/sentence/sentences and run the macro.

Ex. WHO STEPPED ON THE CAT? => Who Stepped on the Cat?

Note that after recording the macro, I added intelligent parsing such that the words "on" and "the" and several others are not capitalized, thanks to Allan Wyatts for his tip. Common words in Title Case that will not be capitalized include "over of the by to this is from a on in under for at."

Here's the macro:

' Changes UPPER CASE to Title Case characters

' Macro recorded 2007/08/28 by Gururaj Rao

'Modified to include intelligent parsing of common words

    Dim wlist As String
    Dim wrd As Integer
    Dim wCheck As String
    ' list of lowercase words, surrounded by spaces
    wlist = " over of the by to this is from a on in under for at"
    Selection.Range.Case = wdTitleWord
    For wrd = 2 To Selection.Range.Words.Count
        wCheck = Trim(Selection.Range.Words(wrd))
        wCheck = " " & LCase(wCheck) & " "
        If InStr(wlist, wCheck) Then
            Selection.Range.Words(wrd).Case = wdLowerCase
        End If
    Next wrd

End Sub

3. Convert hidden, formatted text to plain visible text

I often use this to copy sentence or phrase in hidden source text when translating a document using a CAT tool.

Here's the macro:

Sub Unbold()


' Unbold Macro

' 記録日 2003/11/03 記録者 Gururaj Rao

'Converts hidden text to non-hidden text

With Selection.Font

.NameFarEast = "MS 明朝"

.NameAscii = "MS 明朝"

.NameOther = "Times New Roman"

.Name = "MS 明朝"

.Size = 10.5

.Bold = False

.Italic = False

.Underline = wdUnderlineNone

.UnderlineColor = wdColorAutomatic

.StrikeThrough = False

.DoubleStrikeThrough = False

.Outline = False

.Emboss = False

.Shadow = False

.Hidden = False

.SmallCaps = False

.AllCaps = False

.Color = wdColorAutomatic

.Engrave = False

.Superscript = False

.Subscript = False

.Spacing = 0

.Scaling = 100

.Position = 0

.Kerning = 1

.Animation = wdAnimationNone

.DisableCharacterSpaceGrid = False

.EmphasisMark = wdEmphasisMarkNone

End With

End Sub

4. Create a 5-row by 5-column fixed width, colorful table

Place the cursor at the beginning of a newline and run the macro. This is what you get:

Here's the macro:

Sub Create5ByFiveColorfulTable()


' Create5ByFiveColorfulTable Macro

' Macro recorded 2008/01/18 by Gururaj Rao

ActiveDocument.Tables.Add Range:=Selection.Range, NumRows:=5, NumColumns:= _

5, DefaultTableBehavior:=wdWord9TableBehavior, AutoFitBehavior:= _


With Selection.Tables(1)

If .Style <> "Table Colorful 1" Then

.Style = "Table Colorful 1"

End If

.ApplyStyleHeadingRows = True

.ApplyStyleLastRow = True

.ApplyStyleFirstColumn = True

.ApplyStyleLastColumn = True

End With

End Sub

5. Sorting a table by selecting the column to be sorted, no header row

Place the cursor on the column in the table you wish to sort, and run the macro.

For example, place cursor in the first column of the table below and run it, you get the table on the right.

Here is the macro:

Sub SortTableDescNoHeaderRow()


' SortTableNoHeaderRow Macro

' Macro recorded 2008/01/18 by Gururaj Rao

Selection.Sort ExcludeHeader:=False, FieldNumber:="Column 1", _

SortFieldType:=wdSortFieldJapanJIS, SortOrder:=wdSortOrderDescending, _

FieldNumber2:="", SortFieldType2:=wdSortFieldJapanJIS, SortOrder2:= _

wdSortOrderAscending, FieldNumber3:="", SortFieldType3:= _

wdSortFieldJapanJIS, SortOrder3:=wdSortOrderAscending, Separator:= _

wdSortSeparateByCommas, SortColumn:=False, CaseSensitive:=False, _

LanguageID:=wdJapanese, SubFieldNumber:="Paragraphs", SubFieldNumber2:= _

"Paragraphs", SubFieldNumber3:="Paragraphs"

End Sub

Friday, January 11, 2008

Google Tips

Here are a few tips that I use for effective Google searches.

1. Searching for glossaries related to specific phrases

I sometimes like to find glossaries on topic I'm translating.

In such cases, it helps to pick out a term or several terms in English and insert a 用語集 in the Google search, like this:

+"steering mechanism" +car +用語集

You make sure that the phrase you want exists in the glossary by using quotation marks around it (as in "steering mechanism"), and add "+" signs before words that should be present in the glossary.

The method above led me to a Japanese/English glossary on cars.

2. Searching for definitions in Japanese

To understand or know more about what a Japanese term or phrase means, enclose the phrase between quotation marks inclusive of とは like this:


The first hit gives a clear idea of what 覚醒度 means:


3. Searching for a phrase at a particular site

Suppose you are translating for a client with a large bilingual website and wish to use terms that the client uses, even if no search engine for that site exists. You take the term and include the URL like so:

+"Customize" +用語

(I wanted to find out what "Customize" would be in Japanese and used this search string).

This search will give you all relevant hits that include "customize" and maybe its equivalent in Japanese.

The first hit in Google did tell me that MS uses カスタマイズ for "customize"

4. Searching for specific file types

Sometimes you might need to understand just the basics of a device or a system without too much into its details. I have found that if you search for Powerpoint files using Google (Powerpoint files are generally used for presentations and generally give the basics), you generally get to the basics quickly. After entering the desired term/terms, add a filetype:ppt

Here is one example on an actual search I did to study steering systems in cars.

+"steering system" filetype:ppt

The third hit gave me many of the terms that are used in a steering system together with illustrations.

5. Searching for glossaries in pdf format

By combining 1. and 4. above, lets see if we can find a glossary in pdf format. Type in the terms and narrow it down if you get too many irrelevant hits:

+"information technology" +用語集 +filetype:pdf


+networking +"LAN/WAN" +用語集 +filetype:pdf

6. Using Google for exchange rates

Here's another neat Google trick. Next time you wish to convert one currency to another, don't go searching for currency converter websites. Say you wish to convert 45.6 US dollars to Japanese yen. Just type it in the Google search window:

convert 45.6 US dollars to Japanese yen

Here's what you get immediately.

45.60 U.S. dollars = 4 989.60499 Japanese yen

Read the disclaimer also.

7. Using Google as a calculator

Just type the numbers.

3526 x 452 will give you 1593752

8. Definitions in English

To find out how a word is defined, just use: define word


define crystallography

9. Finding out the time at various locations in the world

To find out the local time in a city just use: time in city


time in New Delhi

That should give you the day, date and the local time in New Delhi.

10. Conversion of units

Google also has a conversion feature.

To convert say Fahrenheit to Celsius, type:

60 degrees Fahrenheit in Celsius

Or to convert miles per hour to km per hour, type:

40 miles per hour in km per hour

Or to convert cubic meters to liters, type:

5.643 cubic meters in liters

If you do have your own favorite tips other than these, post them in Comments. Thanks.

Monday, January 7, 2008

Small, powerful command line utility

I use an application called SlickRun, which is a floating command line utility many times a day. It sits unobtrusively showing you the time and the date in a corner of your screen, and is as small as 175 kb, and best of all it is free. The moment you activate it (Win key +Q), a large number of commands is available at your finger tips – you can launch programs, open files, launch your browser and navigate to your favorite website all by typing a few characters that you specify beforehand. These characters are defined by you as a magic word. For instance, if I type mail in the SlickRun window (which is a small window as shown below), it launches my mail program Becky, which automatically downloads all my mail messages and filters them in to various folders; if I type tt, it fires up Firefox and opens my company website.

Creating magic words is also easy. Suppose you wish to create a magic word for a site that you visit frequently, say the USPTO (patent search site). Open the USPTO site in your web browser. Now right click the SlickRun window, select new magic word, enter uspto as the magic word. Click and drag the eye dropper to the page and it automatically records the URL. That's it. Next time you type uspto, SlickRun will launch your browser and navigate to the Patent Search website.

You can set up parameters to search, for instance, google (characters in bold are what you will enter). Here's what you do:

1. Type your magic word say google.

2. Under "filename or URL" type firefox

3. Under "parameters", type:$W$

4. That's it. Now test it by typing say google "変換"

5. SlickRun should have launched Firefox and given you hits pertaining to the phrase you have typed.

6. If it doesn't work, type the actual path to "firefox" in 2. above (such as c:\Program Files\Mozilla Firefox\firefox.exe)

Here's what I got:

SlickRun also has magic word packs that you can download and add, such as Online Shopping, Web References, Microsoft Office and so on.

Another useful feature of SlickRun is its memo recording or 'jotting' feature. Press Winkey + J and you can copy blocks of text from the screen and paste them into the Jot window that opens. SlickRun saves all these blocks of text. You can search for the text in the memo pad anytime by typing in the Find menu.

Friday, January 4, 2008

Some cool add-ons for Firefox - 1

Hope you have all had a wonderful vacation, and are back in front of your PC refreshed and feeling good – as I am!

Today, I'd like to tell you about a few add-ons to Firefox (I'm not sure whether all these will work with Internet Explorer and other browsers - you'll need to check that yourself) that I use and like a lot. I use Firefox Version 2.00.11 and the latest add-ons mentioned here. If you use the same, these add-ons should work for you too without any problems.

1. Rikaichan

I love this add-on, especially when browsing Japanese pages. What does it do? It is a popup Japanese-English/German/French/Russian dictionary extension for Firefox. I use only the Japanese-English dictionary. You hover the mouse on a Japanese work and the English equivalent pops up. Also has a detailed Kanji view showing meaning, on/kun readings and other information. Note that after you install the main extension (add-on), you need to download and install the dictionary too (Japanese-English dictionary if you wish to look up Japanese) from the same site. Here's what it looks like when I hovered the mouse on top of 造船所:

You can also select any Kanji character and press Alt + Delete to get detailed information on that character, as shown below.

After you install Rikaichan, you can toggle it ON and OFF by clicking Tools/Rikaichan. You may also perform various settings such as changing Hot-keys by opening Tools/Add-ons, selecting Rikaichan and Settings.

2. Needlesearch

I wrote about this extension a few days ago "Quickly searching online references using a browser add-on". I use it to search specific search engines/references. Note that after you install it, you can hide it or show it by Ctrl + F9. This is neat because you get more space when you are not using Needlesearch.

3. IE-Tab

This add-on opens an Internet Explorer-only page in a separate tab within Firefox. Very convenient when you wish to view a website designed only to be viewed with IE – yes, such sites do exist.

Unlike IE-View, which opens IE-only pages in a separate Internet Browser window, IE-Tab opens such a page in a Mozilla/Firefox tab.

4. Cooliris Previews

This add-on lets you preview links and rich-media without clicking or leaving your current page. When you hover the mouse over a link, the Cooliris icon appears. Click on it and you can preview the corresponding page and rich-media without clicking or leaving your current page. An indispensable add-on for me.

5. Split Browser

This add-on splits the browser window. Drag any link to a window and the window displays its content. I find it pretty useful when I wish to compare Japanese and English pages of say the same company and pick up terms. See example below.