Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #Requires AutoHotkey v2.0
- #SingleInstance Force
- PID := DllCall("GetCurrentProcessId")
- ProcessSetPriority "High", PID
- A_HotkeyInterval := 0
- DetectHiddenWindows true
- Hotkey "^9", Exit
- Hotkey "^8", ToggleTaskBarHotkey
- Exit(ThisHotkey){
- WinShow "ahk_class Shell_TrayWnd"
- ExitApp
- }
- TBH := TaskBarHider()
- TBH.getTaskBarRegion()
- ToggleTaskBarHotkey(ThisHotkey){
- TBH.toggle()
- }
- class TaskBarHider {
- showStatus := true
- hideTimer := ObjBindMethod(this, "timer")
- timeStarted := A_TickCount
- timeDelay := 1500
- showNow := false
- TBx1 := 0
- TBx2 := 0
- TBy1 := 0
- TBy2 := 0
- mEntryRegionTolerance := 0
- mEntryX := 0
- mEntryY := 0
- yPassed := false
- getTaskBarRegion(){
- WinShow "ahk_class Shell_TrayWnd"
- WinGetPos &X, &Y, &W, &H, "ahk_class Shell_TrayWnd"
- this.TBx1 := X
- this.TBy1 := Y
- this.TBx2 := X + W
- this.TBy2 := Y + H
- ;MsgBox "Taskbar is at " this.TBx1 ", " this.TBy1 " -> " this.TBx2 ", " this.TBy2
- }
- changeStatus(){
- if(this.showStatus == true){
- WinHide "ahk_class Shell_TrayWnd"
- SetTimer this.hideTimer, 10
- }
- else{
- WinShow "ahk_class Shell_TrayWnd"
- SetTimer this.hideTimer, 0
- }
- }
- toggle(){
- this.showStatus := !(this.showStatus)
- this.changeStatus()
- }
- timer(){
- MouseGetPos &xpos, &ypos
- ;Tooltip "ypos: " ypos ", TBy1: " this.TBy1 ", EntryY: " this.mEntryY "`nxpos: " xpos ", EntryX: " this.mEntryX
- if(ypos >= this.TBy1 && this.mEntryY == 0){
- this.mEntryX := xpos
- this.mEntryY := ypos
- this.timeStarted := A_TickCount
- ;Tooltip "ypos: " ypos ", TBy1: " this.TBy1 ", Entry: " this.mEntryY
- }
- else if(ypos >= this.TBy1 && this.mEntryY != 0){
- if(ypos >= this.mEntryY - this.mEntryRegionTolerance && ypos <= this.mEntryY + this.mEntryRegionTolerance){
- this.yPassed := true
- }
- if(this.showNow == false && this.yPassed == true && A_TickCount - this.timeStarted > this.timeDelay){
- this.showNow := true
- WinShow "ahk_class Shell_TrayWnd"
- }
- else if(this.yPassed == false){
- this.showNow := false
- this.mEntryX := 0
- this.mEntryY := 0
- WinHide "ahk_class Shell_TrayWnd"
- }
- }
- else if(ypos < this.TBy1 && this.mEntryY != 0){
- this.yPassed := false
- this.showNow := false
- this.mEntryX := 0
- this.mEntryY := 0
- this.timeStarted := A_TickCount
- WinHide "ahk_class Shell_TrayWnd"
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement