Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #SingleInstance, Force
- SendMode Input
- SetWorkingDir, %A_ScriptDir%
- #NoEnv ; Recommended for performance and compatibility with future AutoHotkey releases.
- #F1::ListHotkeys
- ; Get system information about window you are hovering over with mouse
- #F2::
- {
- ToolTipToggle := !ToolTipToggle
- if(!ToolTipToggle){
- SetTimer, RemoveToolTip, -1000
- return
- }
- WindowUnderCursorInfo := GetUnderCursorInfo(CursorX, CursorY)
- CoordMode ToolTip, Screen
- ; place tooltip in quadrant opposite of cursor
- If ( CursorX < (A_ScreenWidth // 2) )
- TTXOffset = 150
- Else
- TTXOffset = -150
- If ( CursorY < (A_ScreenHeight // 2) )
- TTYOffset = 150
- Else
- TTYOffset = -150
- #Persistent
- ToolTip %WindowUnderCursorInfo%
- , ( (A_ScreenWidth // 2) + TTXOffset )
- , ( (A_ScreenHeight // 2) + TTYOffset )
- }
- Return
- ; ; Get screen information, such as coordinates.
- ; #F3::
- ; {
- ; SysGet, MouseButtonCount, 43
- ; SysGet, VirtualScreenWidth, 78
- ; SysGet, VirtualScreenHeight, 79
- ; SysGet, MonitorCount, MonitorCount
- ; SysGet, MonitorPrimary, MonitorPrimary
- ; Message .= "Monitor Count:`t" MonitorCount "`nPrimary Monitor:`t" MonitorPrimary
- ; Loop, %MonitorCount%
- ; {
- ; SysGet, MonitorName, MonitorName, %A_Index%
- ; SysGet, Monitor, Monitor, %A_Index%
- ; SysGet, MonitorWorkArea, MonitorWorkArea, %A_Index%
- ; Message .= "`n`nMonitor:`t#" A_Index "`nName:`t" MonitorName "`nLeft:`t" MonitorLeft "(" MonitorWorkAreaLeft " work)`nTop:`t" MonitorTop " (" MonitorWorkAreaTop " work)`nRight:`t" MonitorRight " (" MonitorWorkAreaRight " work)`nBottom:`t" MonitorBottom "(" MonitorWorkAreaBottom " work)"
- ; }
- ; }
- #F4::ExitApp
- #F5::Reload
- #F11::
- WinGet, currentTransparency, Transparent, A
- if (currentTransparency = 150)
- {
- WinSet, Transparent, OFF, A
- }
- else
- {
- WinSet, Transparent, 150, A
- }
- return
- RemoveToolTip:
- ToolTip
- return
- HexToDec(HexVal)
- {
- Old_A_FormatInteger := A_FormatInteger
- SetFormat IntegerFast, D
- DecVal := HexVal + 0
- SetFormat IntegerFast, %Old_A_FormatInteger%
- Return DecVal
- }
- MouseIsOverProcess(ByRef CursorX, ByRef CursorY, sought)
- {
- CoordMode Mouse, Screen
- CoordMode Pixel, Screen
- MouseGetPos, CursorX, CursorY, Window, Control
- WinGet PName, ProcessName, ahk_id %Window%
- return ProcessName:=sought
- }
- GetUnderCursorInfo(ByRef CursorX, ByRef CursorY)
- {
- CoordMode Mouse, Screen
- CoordMode Pixel, Screen
- MouseGetPos, CursorX, CursorY, Window, Control
- WinGetTitle Title, ahk_id %Window%
- WinGetClass Class, ahk_id %Window%
- WinGetPos WindowX, WindowY, Width, Height, ahk_id %Window%
- WinGet PName, ProcessName, ahk_id %Window%
- WinGet PID, PID, ahk_id %Window%
- PixelGetColor BGR_Color, CursorX, CursorY
- clipboard= %Class%
- WindowUnderCursorInfo := "ahk_id " Window "`n"
- . "ahk_class " Class "`n"
- . "title: " Title "`n"
- . "control: " Control "`n"
- . "PID: " PID "`n"
- . "process name: " PName "`n"
- . "top left (" WindowX ", " WindowY ")`n"
- . "(width x height) (" Width " x " Height ")`n"
- . "cursor's window position (" CursorX-WindowX ", " CursorY-WindowY ")`n"
- . "cursor's screen position (" CursorX ", " CursorY ")`n"
- . "BGR color: " BGR_Color " (" HexToDec("0x" SubStr(BGR_Color, 3, 2)) ", "
- . HexToDec("0x" SubStr(BGR_Color, 5, 2)) ", "
- . HexToDec("0x" SubStr(BGR_Color, 7, 2)) ")`n"
- Return WindowUnderCursorInfo
- }
- applog(text){ ;log to the application file
- FormatTime, Time,, dd/MM/yyyy HH:mm:ss tt
- FileAppend, %Time% %text%`n, %A_WorkingDir%\app.log
- }
- ClickAtPos(x := 0, y := 0)
- {
- MouseMove, x, y
- Click
- }
Add Comment
Please, Sign In to add comment