Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #NoEnv
- SetBatchLines,-1
- SetKeyDelay,0
- SetWinDelay,20
- loop
- {
- lang:=InputLayout()
- If (lang = "Russian")
- {
- TaskBar_SetAttr(1, 0x000055bb)
- }
- Else If (lang = "English")
- {
- TaskBar_SetAttr(1, 0x00000000)
- }
- Gui, +AlwaysOnTop
- sleep, 50
- }
- 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
- }
- TaskBar_SetAttr(accent_state := 0, gradient_color := "0x01000000")
- {
- static init, hTrayWnd, ver := DllCall("GetVersion") & 0xff < 10
- static pad := A_PtrSize = 8 ? 4 : 0, WCA_ACCENT_POLICY := 19
- if !(init) {
- if (ver)
- throw Exception("Minimum support client: Windows 10", -1)
- if !(hTrayWnd := DllCall("user32\FindWindow", "str", "Shell_TrayWnd", "ptr", 0, "ptr"))
- throw Exception("Failed to get the handle", -1)
- init := 1
- }
- accent_size := VarSetCapacity(ACCENT_POLICY, 16, 0)
- NumPut((accent_state > 0 && accent_state < 4) ? accent_state : 0, ACCENT_POLICY, 0, "int")
- if (accent_state >= 1) && (accent_state <= 2) && (RegExMatch(gradient_color, "0x[[:xdigit:]]{8}"))
- NumPut(gradient_color, ACCENT_POLICY, 8, "int")
- VarSetCapacity(WINCOMPATTRDATA, 4 + pad + A_PtrSize + 4 + pad, 0)
- && NumPut(WCA_ACCENT_POLICY, WINCOMPATTRDATA, 0, "int")
- && NumPut(&ACCENT_POLICY, WINCOMPATTRDATA, 4 + pad, "ptr")
- && NumPut(accent_size, WINCOMPATTRDATA, 4 + pad + A_PtrSize, "uint")
- if !(DllCall("user32\SetWindowCompositionAttribute", "ptr", hTrayWnd, "ptr", &WINCOMPATTRDATA))
- throw Exception("Failed to set transparency / blur", -1)
- return true
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement