Advertisement
Guest User

Untitled

a guest
Jan 2nd, 2025
271
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.05 KB | Source Code | 0 0
  1. #NoEnv
  2. SetBatchLines,-1
  3. SetKeyDelay,0
  4. SetWinDelay,20
  5. loop
  6. {
  7. lang:=InputLayout()
  8. If (lang = "Russian")
  9. {
  10. TaskBar_SetAttr(1, 0x000055bb)
  11. }
  12. Else If (lang = "English")
  13. {
  14. TaskBar_SetAttr(1, 0x00000000)
  15. }
  16. Gui, +AlwaysOnTop
  17. sleep, 50
  18. }
  19.  
  20. InputLayout()
  21. {
  22. WinGetClass, Class, % "ahk_id" hID := WinExist("A")
  23. if !id := DllCall("GetWindow", Ptr, hid, UInt, GW_OWNER := 4, Ptr)
  24. id:=hID
  25. ThreadID := DllCall("GetWindowThreadProcessId", "Int", id, "Int", 0)
  26. HKL := DllCall("GetKeyboardLayout", "uint", ThreadID, "UShort")
  27. VarSetCapacity(sKbd, 260, 0)
  28. DllCall("GetLocaleInfo", "uint", HKL
  29. , "uint", 0x1001
  30. , "str", sKbd
  31. , "uint", 260)
  32. Return sKbd
  33. }
  34.  
  35. TaskBar_SetAttr(accent_state := 0, gradient_color := "0x01000000")
  36. {
  37. static init, hTrayWnd, ver := DllCall("GetVersion") & 0xff < 10
  38. static pad := A_PtrSize = 8 ? 4 : 0, WCA_ACCENT_POLICY := 19
  39.  
  40. if !(init) {
  41. if (ver)
  42. throw Exception("Minimum support client: Windows 10", -1)
  43. if !(hTrayWnd := DllCall("user32\FindWindow", "str", "Shell_TrayWnd", "ptr", 0, "ptr"))
  44. throw Exception("Failed to get the handle", -1)
  45. init := 1
  46. }
  47.  
  48. accent_size := VarSetCapacity(ACCENT_POLICY, 16, 0)
  49. NumPut((accent_state > 0 && accent_state < 4) ? accent_state : 0, ACCENT_POLICY, 0, "int")
  50.  
  51. if (accent_state >= 1) && (accent_state <= 2) && (RegExMatch(gradient_color, "0x[[:xdigit:]]{8}"))
  52. NumPut(gradient_color, ACCENT_POLICY, 8, "int")
  53.  
  54. VarSetCapacity(WINCOMPATTRDATA, 4 + pad + A_PtrSize + 4 + pad, 0)
  55. && NumPut(WCA_ACCENT_POLICY, WINCOMPATTRDATA, 0, "int")
  56. && NumPut(&ACCENT_POLICY, WINCOMPATTRDATA, 4 + pad, "ptr")
  57. && NumPut(accent_size, WINCOMPATTRDATA, 4 + pad + A_PtrSize, "uint")
  58. if !(DllCall("user32\SetWindowCompositionAttribute", "ptr", hTrayWnd, "ptr", &WINCOMPATTRDATA))
  59. throw Exception("Failed to set transparency / blur", -1)
  60. return true
  61. }
  62.  
  63.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement