Toggle_Window(Window:="") {
static A := Init()
if (!Window)
MouseGetPos,,, Window
WinGet, S, Style, % (i := "_" Window) ? "ahk_id " Window :
if (S & +0xC00000) {
WinGet, IsMaxed, MinMax, % "ahk_id " Window
if (A[i, "Maxed"] := IsMaxed = 1 ? true : false)
WinRestore, % "ahk_id " Window
WinGetPos, X, Y, W, H, % "ahk_id " Window
for k, v in ["X", "Y", "W", "H"]
A[i, v] := %v%
Loop, % A.MCount {
if (X >= A.Monitor[A_Index].Left
&& X < A.Monitor[A_Index].Right
&& Y >= A.Monitor[A_Index].Top
&& Y < A.Monitor[A_Index].Bottom) {
WinSet, Style, -0xC00000, % "ahk_id " Window
break
}
}
}
else if (S & -0xC00000) {
WinSet, Style, +0x40000, % "ahk_id " Window
WinSet, Style, +0xC00000, % "ahk_id " Window
WinMove, % "ahk_id " Window,, A[i].X, A[i].Y, A[i].W, A[i].H
if (A[i].Maxed)
WinMaximize, % "ahk_id " Window
A.Remove(i)
}
}
Init() {
A := {}
SysGet, n, MonitorCount
Loop, % A.MCount := n {
SysGet, Mon, Monitor, % i := A_Index
for k, v in ["Left", "Right", "Top", "Bottom"]
A["Monitor", i, v] := Mon%v%
}
return A
}
/*
* * * Compile_AHK SETTINGS BEGIN * * *
[AHK2EXE]
Exe_File=%In_Dir%\layout_indicator_result.exe
Compression=0
No_UPX=1
[ICONS]
Icon_1=C:\Users\mkone\ico\chinesse_char.ico
* * * Compile_AHK SETTINGS END * * *
*/
; ПРОЗРАЧНЫЙ ДЛЯ КЛИКОВ ИНДИКАТОР РАСКЛАДКИ
#noenv
;it seems for singleinstanse(no messages)
#singleinstance, ignore
setbatchlines, -1
setworkingdir, %a_scriptdir%
;i don't know what this
Gui Color, 0xFF0000
;+E0x20 for click throught gui
;+hWnd<ID> create Id for Gui
Gui, main_window:New, +E0x20 -Caption +LastFound +ToolWindow +AlwaysOnTop +hWndMAIN
WinSet, Transparent, 230
;unpack screen width, height with var_ prefix?
sysget, var_, monitorworkarea
;near to taskbar height
size := var_right / 64
;indicator main colors
english_color := "FAFAFA"
other_color := "303030"
;select color for init
color := check_lang() ? english_color : other_color
;add indicator
gui, add, listview, x0 y0 w%size% h%size% -hdr -e0x200 -multi background%color% v_lang
x := (var_right-size)
y := (var_bottom-size)
gui, show, x%x% y%y% na, OSD
Loop {
sleep, 200
color := check_lang() ? english_color : other_color
gui, show, x%x% y%y% na, OSD
guicontrol, +background%color%, _lang
}
check_lang() {
;English := "0xfffffffff0c00409"
curr_lang := DllCall("GetKeyboardLayout", "Int", DllCall("GetWindowThreadProcessId", "Int", WinActive("A"), "Int", 0))
;curr_lang := Format("0x{:x}", curr_lang_hex)
;i := (English = curr_lang)
;Msgbox %curr_lang%, %English%
if (curr_lang == -255785975||curr_lang == -255851511) {
;MsgBox, 1
Return true
} else {
Return false
}
}
Pause::
WinGet, transparency, transparent, ahk_id %MAIN%
if (transparency = 0) {
WinSet, Transparent, 230, ahk_id %MAIN%
} else {
WinSet, Transparent, 0, ahk_id %MAIN%
}
return
у меня были случаи, когда и гугл падал.