Monday, March 17, 2008

Searching dictionaries quickly while you translate

Interaction/Feedback

A small note before today's post. I have not had the interaction that I expected with readers through comments. I can only assume that this is because of "user-non-friendliness" of this blog. I have taken steps to remedy this by providing instructions on the right on how to post comments and how to post your messages directly to my mailbox, if you do not wish to post to a public forum. I look forward to interaction and feedback. If you like something say so. If you don't like something -- well, don't say a thing. :)

Searching JE/EJ online dictionaries

Today, I give you an Autohotkey script that I hacked, which will enable you to search four standard online Japanese English dictionaries while you translate. You can selectively search any of these, when you get stuck on an English or a Japanese term or phrase during your translation work. I have tested the script on Mozilla Firefox running on a Windows XP system. Hopefully, it should work on other browsers. The four dictionaries are: Progressive/Daijirin, Exceed/Daijirin, Kenkyusha Online and Sanseido Daily Concise dictionaries made available by Yahoo, MSN, Excite and Sanseido respectively.

Procedure

The procedure is as follows:

a. I assume that you have already installed Autohotkey – if not, read an earlier post introducing this free utility, and install it on your system.

b. Copy the script at the end of the post to a plain text editor, and save it in a suitable folder say with the following name: gendic.ahk

c. Open Explorer, go to the folder where you have saved this file, and double click on gendic.ahk

d. You should see a green icon with an H in your system tray indicating that the script has been loaded.

That's all there is to it -- you are now ready to go! Select the phrase or term, hold down the Win key and hit 'g' (indicating "general" dictionaries). The screen shown below should appear:


Select the dictionary you wish to search and hit Enter!

Let me know it if works for you too, as it did for me.


Script

Gui, Add, Radio, x7 y40 w240 h20 Checked vDict, Progressive

Gui, Add, Radio, x7 y60 w240 h20, Exceed

Gui, Add, Radio, x7 y80 w240 h20, Kenkyusha

Gui, Add, Radio, x7 y100 w240 h20, Sanseido

Gui, Add, Text, x7 y10 w240 h20, Select Dict:

Gui, Add, Button, x86 y120 w70 h20 Default, Ok

Gui, Show, h185 w251 +hide, Selection

RunOnce = 0

Return

#g::

RunOnce=0

#z::

Send,^c

if (RunOnce = 0 or SendThis =)

{

Gui, Show, h185 w251, Selection

WinGet, SelId, ID, Selection

WinWaitClose, ahk_id %SelId%

if SendThis <>

{

Send,!d

Send, %SendThis%

}

}

;Send, {Enter}

Return

ButtonOk:

Gui, Submit

if Dict = 1

run "http://dic.yahoo.co.jp/dsearch?enc=UTF-8&p=%clipboard%&stype=0&dtype=2"

else if Dict = 2

run "http://dictionary.msn.co.jp/result.aspx?keyword=%clipboard%&matchtype=startwith"

else if Dict = 3

run "http://www.excite.co.jp/dictionary/japanese_english/?search=%clipboard%&match=beginswith"

else if Dict = 4

run "http://www.sanseido.net/User/Dic/Index.aspx?TWords=%clipboard%&st=0&DailyJJ=checkbox&DailyEJ=checkbox&DailyJE=checkbox"

RunOnce = 1

Return

4 comments:

Phil said...

Very cool. I modified the script so it would open all the online dictionaries with just #z instead of having to choose one. Thanks!

Gururaj Rao said...

Phil,
That's good. Maybe others who wish to do the same may benefit if you post the modification to the script here.

Phil said...

The script is much simpler than the one you wrote.

below will copy the highlighted text and search the clipboard in Yahoo dic when pushing Winkey Z and open msn dic when pushing Winkey M
#z::

Send,^c

run http://dic.yahoo.co.jp/dsearch?enc=UTF-8&p=%clipboard%&stype=0&dtype=2

return

#m::

Send,^c

run http://dictionary.msn.co.jp/result.aspx?keyword=%clipboard%

return

Below is open both at the same time when pressing winkey z.

#z::

Send,^c

run http://dictionary.msn.co.jp/result.aspx?keyword=%clipboard%
run http://dic.yahoo.co.jp/dsearch?enc=UTF-8&p=%clipboard%&stype=0&dtype=2

return

Once you know this pattern you can add any search engine using the hotkey.

For example I use this to search for the English titles for an anime when translating a cosplay magazine.

#a::

Send,^c

run http://www.animenewsnetwork.com/encyclopedia/search/name?q=%clipboard%

return

Gururaj Rao said...

Phil,
If you keep searching for words while working, you may have a large number of instances of browser running. How about this script - it waits for 7 seconds while you read the search hits, then asks you whether to close down the browser; let me know if this works for you:
#z::
Send,^c
run http://dictionary.msn.co.jp/result.aspx?keyword=%clipboard%
run http://dic.yahoo.co.jp/dsearch?enc=UTF-8&p=%clipboard%&stype=0&dtype=2
Sleep, 7000 ;7 seconds
MsgBox, 4,, Close Browser? (press Yes or No)
IfMsgBox Yes
Send, LShift^W
else
return