#NoEnv
#Persistent
#Singleinstance, force
SetWorkingDir, %A_ScriptDir%/res
SetBatchLines,-1
CoordMode,Mouse,Screen
CoordMode,tooltip,Screen
CoordMode,Caret,Screen
SetKeyDelay, -1, -1
SetWinDelay,20
OnExit, Exit
if (xxxx="")
{
xxxx=555
RegWrite, REG_SZ, HKEY_LOCAL_MACHINE, SOFTWARE\Scriptss, xdirectory, %xxxx%
}
if (yyyy="")
{
yyyy=111
RegWrite, REG_SZ, HKEY_LOCAL_MACHINE, SOFTWARE\Scriptss, ydirectory, %yyyy%
}
Gui, +AlwaysOnTop -Caption +ToolWindow +LastFound
Gui, Add, Picture, x0 y0 w20 h16 vStatic1, Ru1.png
Gui, Add, Picture, x0 y0 w20 h16 vStatic2, En1.png
Gui, Show, x%xxxx% y%yyyy% h16 w20 NA, lang053
;======================== Меню ===================================
RegRead, xxxx, HKEY_LOCAL_MACHINE, SOFTWARE\Scriptss, xdirectory
RegRead, yyyy, HKEY_LOCAL_MACHINE, SOFTWARE\Scriptss, ydirectory
hGui:=WinExist()
loop
{
MouseGetPos,,,mwin
oldlang:=lang
lang:=InputLayout()
if (oldlang!=lang)
If (lang = "Russian")
{
Menu, Tray, Icon, Ru.ico, 1, 1
GuiControl, hide, static2
GuiControl, Show, static1
}
Else If (lang = "English")
{
Menu, Tray, Icon, En.ico, 1, 1
GuiControl, hide, static1
GuiControl, Show, static2
}
Gui, +AlwaysOnTop -Caption +ToolWindow +LastFound
sleep, 50
}
#if (mwin=hGui)
lbutton::
MoveWin(hGui)
return
#if
MoveWin(hwnd,key="lbutton")
{
MouseGetPos,oldmmx,oldmmy
while GetKeyState(key,"P")
{
sleep,10
MouseGetPos,mmx,mmy
WinGetPos,wx,wy,ww,wh,ahk_id %hwnd%
wx:=wx+mmx-oldmmx
wy:=wy+mmy-oldmmy
WinMove,ahk_id %hwnd%,,%wx%,%wy%
oldmmx:=mmx
oldmmy:=mmy
}
return
}
InputLayout()
{
WinGetClass, Class, % "ahk_id" hID := WinExist("A")
if !id := DllCall("GetWindow", Ptr, hid, UInt, GW_OWNER := 4, Ptr)
id:=hID
ThreadID := DllCall("GetWindowThreadProcessId", "Int", id, "Int", 0)
HKL := DllCall("GetKeyboardLayout", "uint", ThreadID, "UShort")
VarSetCapacity(sKbd, 260, 0)
DllCall("GetLocaleInfo", "uint", HKL
, "uint", 0x1001
, "str", sKbd
, "uint", 260)
Return sKbd
}
Exit:
IfWinExist, lang053
{
WinGetPos, xxxx, yyyy
}
RegWrite, REG_SZ, HKEY_LOCAL_MACHINE, SOFTWARE\Scriptss, xdirectory, %xxxx%
sleep, 60
RegWrite, REG_SZ, HKEY_LOCAL_MACHINE, SOFTWARE\Scriptss, ydirectory, %yyyy%
sleep, 60
Exitapp