SHARE
TWEET

ww AHK Border -firefox

a guest Dec 22nd, 2012 1,944 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. ; Uncomment this if you want a hotkey to set it for every
  2. ; !+r::GoSub, AdjustAllWindows
  3.  
  4. ; Initalise the hook
  5. GoSub, HookWindow
  6. ; Run it once for every window
  7. GoSub, AdjustAllWindows
  8. Return
  9.  
  10. HookWindow:
  11.    ; New Window Hook
  12.     Gui +LastFound
  13.     hWnd := WinExist()
  14.  
  15.     DllCall( "RegisterShellHookWindow", UInt,hWnd )
  16.     MsgNum := DllCall( "RegisterWindowMessage", Str,"SHELLHOOK" )
  17.     OnMessage( MsgNum, "ShellMessage" )
  18.  
  19.     ShellMessage(wParam,lParam) {
  20.         If (wParam = 1) ;  HSHELL_WINDOWCREATED := 1
  21.         {
  22.             Sleep, 10
  23.             AdjustWindow(lParam)
  24.         }
  25.     }
  26. Return
  27.  
  28. ; Adjust Window
  29. AdjustWindow(id)
  30. {
  31.     WinId := id
  32.     WinTitle := id = "A" ? "A" : "ahk_id " . id
  33.     WinGet, WinProcess, ProcessName, %WinTitle%
  34.  
  35.     ; Exclude Firefox
  36.     ToolTip, % WinProcess
  37.     If (WinProcess <> "firefox.exe")
  38.     {
  39.         WinSet, Style, -0xC00000, %WinTitle%
  40.     }
  41.     ListLines
  42.     Pause
  43. }
  44.  
  45. AdjustAllWindows:
  46.    WinGet, id, list,,, Program Manager
  47.     Loop, %id%
  48.     {
  49.         AdjustWindow(id%A_Index%)
  50.     }
  51. Return
RAW Paste Data
Challenge yourself this year...
Learn something new in 2017
Top