了解知识
autohotkey
昨天试了下autohotkey感觉还好 。语法简单,但我不是很喜欢语法的style,觉得如果代码的比较长时检错会很困难。但对于autohotkey这个名字来讲是它是很称职的,编写快捷键很方便。
 
昨天拼凑的autohotkey代码, alt+滚轮横向转屏,选词后ctrl+alt+D直接调用Lingoes,Merriam-Webster,Collins COBUILD,Babylon字典查词。
 
DetectHiddenWindows, On 
SetTitleMatchMode, 2
 
^+d::
    tmp = %clipboard%
    Send, ^c
    word = %clipboard%
    StringLower , word , word
    clipboard = %tmp%
    tmp =
 
IfWinExist , Lingoes ahk_class Afx:400000:0 
{    
WinWait, Lingoesahk_class Afx:400000:0, 
IfWinNotActive, Lingoes ahk_class Afx:400000:0, , WinActivate, Lingoes ahk_class Afx:400000:0, 
WinWaitActive, Lingoes ahk_class Afx:400000:0, 
Send, {ESC}%word%{ENTER}{ENTER} 
}    
 
IfWinExist , Merriam-Webster's 11th Collegiate Dictionary 
{
 
    WinWait, Merriam-Webster's 11th Collegiate Dictionary , 
IfWinNotActive, Merriam-Webster's 11th Collegiate Dictionary , , WinActivate, Merriam-Webster's 11th Collegiate Dictionary , 
WinWaitActive, Merriam-Webster's 11th Collegiate Dictionary , 
 
 
Send, {ESC}%word%{ENTER}{ENTER}
}
 
IfWinExist , Collins COBUILD Dictionary on CD-ROM 2006
{
WinWait, Collins COBUILD Dictionary on CD-ROM 2006, 
IfWinNotActive, Collins COBUILD Dictionary on CD-ROM 2006, , WinActivate, Collins COBUILD Dictionary on CD-ROM 2006, 
WinWaitActive, Collins COBUILD Dictionary on CD-ROM 2006, 
 
 
Send, {ESC}%word%{ENTER}{ENTER} 
}
 
Process, Exist, Babylon.exe
if errorlevel = 0
{
    ;Run, D:/Dictionaries/Babylon-Pro/Babylon.exe
    ;Process, Wait, Babylon.exe
    ;WinWait, ahk_class Babylon
    ;Run, D:/Dictionaries/Babylon-Pro/Babylon.exe 
}
else
{
IfWinNotExist, Babylon ahk_class #32770, SplitArea
Run, D:/Dictionaries/Babylon-Pro/Babylon.exe
; Activate and paste text
IfWinNotActive, Babylon ahk_class #32770, SplitArea, WinActivate, Babylon ahk_class #32770, SplitArea, 
WinWaitActive, Babylon ahk_class #32770, SplitArea
ControlFocus, Edit1, Babylon ahk_class #32770, SplitArea
Control, EditPaste, %word%, Edit1, Babylon ahk_class #32770, SplitArea
SendInput, {ENTER}
}
 
return 
 
 
!WheelUp::  ; Scroll left.
ControlGetFocus, fcontrol, A
Loop 7  ; <-- Increase this value to scroll faster.
    SendMessage, 0x114, 0, 0, %fcontrol%, A  ; 0x114 is WM_HSCROLL and the 0 after it is SB_LINERIGHT. 
return
 
!WheelDown::  ; Scroll right.
ControlGetFocus, fcontrol, A
Loop 7  ; <-- Increase this value to scroll faster.
    SendMessage, 0x114, 1, 0, %fcontrol%, A  ; 0x114 is WM_HSCROLL and the 1 after it is SB_LINELEFT. 
return
 
标签: AutoHotkey
扩展知识