Autohotkey and Microsoft Encarta Dictionary Tools


According to gwaion's autohotkey script for babylon, I build a script for Microsoft Encarta Dictionary Tools.
; OPTIONS
;----------------------
#NoEnv
SetTitleMatchMode, 2
DetectHiddenWindows, On
;----------------------
; Check if Babylon is running,if not execute
Process, Exist, edict.exe
if errorlevel = 0
{
    	Run, ./edict.exe
    	Process, Wait, edict.exe
    	WinWait, ahk_class L05AXLRD_EDICT
    	Run, ./edict.exe
}
else
WinRestore, Encarta Dictionary Tools ahk_class L05AXLRD_EDICT
;IfWinNotExist, Encarta Dictionary Tools ahk_class L05AXLRD_EDICT
;Run, ./EDICT.EXE
; Activate and paste text
{
    	IfWinNotActive, Encarta Dictionary Tools ahk_class L05AXLRD_EDICT, Dictionary, WinActivate, Encarta Dictionary Tools ahk_class L05AXLRD_EDICT
    	WinWaitActive, Encarta Dictionary Tools ahk_class L05AXLRD_EDICT
    	ControlFocus, Edit1, Encarta Dictionary Tools ahk_class L05AXLRD_EDICT
    	; Check if script is used with parameters
    	Control, EditPaste, %1%, Edit1, Encarta Dictionary Tools ahk_class L05AXLRD_EDICT
    	SendInput, {ENTER}
}