tabnation

smart lock ahk v1

Mar 13th, 2026
111
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.67 KB | None | 0 0
  1.  
  2. ; --- Settings ---
  3. W := 80 ; Width of the LOCK button
  4. H := 30 ; Height
  5. LineW := 2 ; Black divider line
  6. CloseW := 25 ; Width of the X button
  7. TotalW := W + LineW + CloseW
  8.  
  9. Gui, 1:+AlwaysOnTop -Caption +ToolWindow +Border
  10.  
  11. ; 1. Main Toggle Zone (Left)
  12. Gui, 1:Color, Green
  13. Gui, 1:Font, s14 Bold cWhite, Arial
  14. Gui, 1:Add, Text, x0 y0 w%W% h%H% Center 0x200 gToggleTouch vStatusText, LOCK
  15.  
  16. ; 2. Black Divider Line
  17. Gui, 1:Add, Progress, x%W% y0 w%LineW% h%H% cBlack, 100
  18.  
  19. ; 3. Close Zone (Right)
  20. Gui, 1:Add, Text, % "x" W + LineW " y0 w" CloseW " h" H " Center 0x200 Background666666 gGuiClose", X
  21.  
  22. Gui, 1:Show, x5 y5 w%TotalW% h%H%, TouchToggle
  23. return
  24.  
  25. ToggleTouch:
  26. toggled := !toggled
  27. if (toggled) {
  28. ; --- SHIELD 1: Everything to the right of the buttons ---
  29. Gui, 2:+AlwaysOnTop -Caption +ToolWindow +LastFound
  30. WinSet, Transparent, 1
  31. Gui, 2:Color, Black
  32. ; Starts at the end of the buttons, covers the rest of the width
  33. Gui, 2:Show, % "x" TotalW + 107 " y0 w" A_ScreenWidth " h" A_ScreenHeight, ShieldRight
  34.  
  35. ; --- SHIELD 2: Everything below the buttons ---
  36. Gui, 3:+AlwaysOnTop -Caption +ToolWindow +LastFound
  37. WinSet, Transparent, 1
  38. Gui, 3:Color, Black
  39. ; Starts below the buttons, covers the full screen height remaining
  40. Gui, 3:Show, % "x0 y" H + 107 " w" TotalW + 5 " h" A_ScreenHeight, ShieldBottom
  41.  
  42. Gui, 1:Color, Red
  43. GuiControl, 1:, StatusText, UNLOCK
  44. } else {
  45. Gui, 2:Destroy
  46. Gui, 3:Destroy
  47.  
  48. Gui, 1:Color, Green
  49. GuiControl, 1:, StatusText, LOCK
  50. }
  51. return
  52. f1::
  53. GuiClose:
  54. ExitApp
Advertisement
Add Comment
Please, Sign In to add comment