wvxwxvw (
14:01 20-11-2015)
Цитата: Может выложите полную версию, а я скомпилю, иконки добавлю, да в шапки закину?
    [more=Версия с флагом...]  
Код:   ;  Автор скрипта Irbis 
 ;  
http://forum.script-coding.com/viewtopic.php?id=10392&p=3     #NoEnv 
 CoordMode Caret 
 CoordMode Tooltip 
 CoordMode Mouse 
 SetWinDelay -1 
 SetBatchLines -1 
 SetWorkingDir %A_ScriptDir% 
 Color:={"English":"0x0C0BC0", "Russian":"0xC00C0B"} 
 w0:=16, h0:=12, w1:=20, h1:=16, DX := 8, DY := 0 
 Gui, +AlwaysOnTop -Caption +ToolWindow +LastFound +HwndGuiHwnd 
 Gui,Add, Picture,x4 y4, % FileFromUrl("Data\Shadow.png", "https://tr.im/vZ51e") 
 Gui,Add, Picture,x0 y0 +HwndIconEn, % FileFromUrl("Data\En.png", "https://tr.im/va4UW") 
 Gui,Add, Picture,x0 y0 +HwndIconRu, % FileFromUrl("Data\Ru.png", "https://tr.im/ukp67") 
 Gui, Color, 0x3F3F3F 
 WinSet, TransColor, 0x3F3F3F 
 SetTimer, WatchCaret, 50 
 return   
 #If (id=GuiHwnd) 
 LButton:: 
    SetTimer, WatchCaret, Off 
    MouseGetPos, x0, y0 
    WinGetPos xc, yc,,, ahk_id %GuiHwnd% 
    xc-=x0, yc-=y0 
    While GetKeyState("Lbutton", "P") { 
       sleep 10 
       MouseGetPos, xn, yn 
       WinMove, ahk_id %GuiHwnd%,, xc+xn, yc+yn 
    } 
    DX+=xn-x0, DY+=yn-y0 
    if A_TimeSinceThisHotkey < 400 
       PostMessage, 0x50, 2,,, A 
    SetTimer, WatchCaret, On 
 Return 
 #If   
 WatchCaret: 
    MouseGetPos,,,id 
    Control, % (InputLayout()="English") ? "Hide" : "Show",,,ahk_id %IconRu% 
    w := GetKeyState("CapsLock", "T") ? w1 : w0, h := GetKeyState("CapsLock", "T") ? h1 : h0   
    (A_CaretX = "" && AccObjectFromPoint())   
    Gui, % (x:=A_CaretX+DX)&&(y:=A_CaretY+DY)&&(GuiHwnd!=WinExist("A")) ? "Show" : "Hide" 
           , x%x% y%y% w%w% h%h% NA 
 Return   
 ; скачивание недостающих ресурсов. 
 FileFromUrl(to, from) { 
    if !FileExist(to) 
    try { 
       Loop, Parse, to, \ 
       { 
          path .= path ? "\" . A_LoopField : A_LoopField 
          if (to != path) 
             FileCreateDir, %path% 
       } UrlDownloadToFile, %from%, %to% 
    } catch { 
       MsgBox, 16,, Ошибка скачивания: %to% 
        ExitApp 
    } Return to 
 }   
 InputLayout(window := "A") { 
    If !(hWnd := WinExist(window)) 
       return 
    WinGetClass, Class 
    if (Class == "ConsoleWindowClass"){ 
        WinGet, consolePID, PID 
        DllCall("AttachConsole", Ptr, consolePID) 
        VarSetCapacity(buff, 16) 
        DllCall("GetConsoleKeyboardLayoutName", Str, buff), 
        DllCall("FreeConsole") 
        langID := "0x" . SubStr(buff, -3) 
    } 
    Else langID := DllCall("GetKeyboardLayout", Ptr, DllCall("GetWindowThreadProcessId", Ptr, hWnd, UInt, 0, Ptr), Ptr) & 0xFFFF 
    Size := (DllCall("GetLocaleInfo", UInt, langID, UInt, 0x1001, UInt, 0, UInt, 0) * 2)   ; LOCALE_SENGLANGUAGE := 0x1001 
    VarSetCapacity(localeSig, Size, 0) 
    DllCall("GetLocaleInfo", UInt, langID, UInt, 0x1001, Str, localeSig, UInt, Size) 
    return localeSig 
 }   
 AccObjectFromPoint(ByRef _idChild_ = "", x = "", y = "") 
 { 
    static VT_DISPATCH := 9, h := DllCall("LoadLibrary", Str, "oleacc", Ptr)      
    (x = "" || y = "") ? DllCall("GetCursorPos", Int64P, pt) : pt := x & 0xFFFFFFFF | y << 32   
    VarSetCapacity(varChild, 8 + 2*A_PtrSize, 0) 
    if   DllCall("oleacc\AccessibleObjectFromPoint", Int64, pt, PtrP, pAcc, Ptr, &varChild) = 0 
       Return ComObjEnwrap(VT_DISPATCH, pAcc, 1), _idChild_ := NumGet(varChild, 8, "UInt") 
 }