d3ullist

WindowsUtillity

Mar 1st, 2022 (edited)
128
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. #SingleInstance, Force
  2. SendMode Input
  3. SetWorkingDir, %A_ScriptDir%
  4. #NoEnv  ; Recommended for performance and compatibility with future AutoHotkey releases.
  5.  
  6. #F1::ListHotkeys
  7.  
  8. ; Get system information about window you are hovering over with mouse
  9. #F2::
  10. {
  11.     ToolTipToggle := !ToolTipToggle
  12.     if(!ToolTipToggle){
  13.         SetTimer, RemoveToolTip, -1000
  14.         return
  15.     }
  16.    
  17.    WindowUnderCursorInfo := GetUnderCursorInfo(CursorX, CursorY)
  18.    CoordMode ToolTip, Screen
  19.    ; place tooltip in quadrant opposite of cursor
  20.    If ( CursorX < (A_ScreenWidth // 2) )
  21.       TTXOffset = 150
  22.    Else
  23.       TTXOffset = -150
  24.    If ( CursorY < (A_ScreenHeight // 2) )
  25.       TTYOffset = 150
  26.    Else
  27.       TTYOffset = -150
  28.     #Persistent
  29.     ToolTip %WindowUnderCursorInfo%
  30.       , ( (A_ScreenWidth // 2) + TTXOffset )
  31.       , ( (A_ScreenHeight // 2) + TTYOffset )
  32. }
  33. Return
  34.  
  35. ; ; Get screen information, such as coordinates.
  36. ; #F3::
  37. ; {
  38. ;   SysGet, MouseButtonCount, 43
  39. ;   SysGet, VirtualScreenWidth, 78
  40. ;   SysGet, VirtualScreenHeight, 79
  41.  
  42. ;   SysGet, MonitorCount, MonitorCount
  43. ;   SysGet, MonitorPrimary, MonitorPrimary
  44. ;   Message .= "Monitor Count:`t" MonitorCount "`nPrimary Monitor:`t" MonitorPrimary
  45. ;   Loop, %MonitorCount%
  46. ;   {
  47. ;       SysGet, MonitorName, MonitorName, %A_Index%
  48. ;       SysGet, Monitor, Monitor, %A_Index%
  49. ;       SysGet, MonitorWorkArea, MonitorWorkArea, %A_Index%
  50. ;       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)"
  51. ;   }
  52. ; }
  53.  
  54. #F4::ExitApp
  55. #F5::Reload
  56.  
  57. #F11::
  58.     WinGet, currentTransparency, Transparent, A
  59.     if (currentTransparency = 150)
  60.     {
  61.         WinSet, Transparent, OFF, A
  62.     }
  63.     else
  64.     {
  65.         WinSet, Transparent, 150, A
  66.     }
  67. return
  68.  
  69.  
  70. RemoveToolTip:
  71. ToolTip
  72. return
  73.  
  74. HexToDec(HexVal)
  75. {
  76.    Old_A_FormatInteger := A_FormatInteger
  77.    SetFormat IntegerFast, D
  78.    DecVal := HexVal + 0
  79.    SetFormat IntegerFast, %Old_A_FormatInteger%
  80.    Return DecVal
  81. }
  82.  
  83. MouseIsOverProcess(ByRef CursorX, ByRef CursorY, sought)
  84. {
  85.    CoordMode Mouse, Screen
  86.    CoordMode Pixel, Screen
  87.    MouseGetPos, CursorX, CursorY, Window, Control
  88.    WinGet PName, ProcessName, ahk_id %Window%
  89.    return ProcessName:=sought
  90. }
  91.  
  92. GetUnderCursorInfo(ByRef CursorX, ByRef CursorY)
  93. {
  94.    CoordMode Mouse, Screen
  95.    CoordMode Pixel, Screen
  96.    MouseGetPos, CursorX, CursorY, Window, Control
  97.    WinGetTitle Title, ahk_id %Window%
  98.    WinGetClass Class, ahk_id %Window%
  99.    WinGetPos WindowX, WindowY, Width, Height, ahk_id %Window%
  100.    WinGet PName, ProcessName, ahk_id %Window%
  101.    WinGet PID, PID, ahk_id %Window%
  102.    PixelGetColor BGR_Color, CursorX, CursorY
  103.    clipboard= %Class%
  104.    
  105.    WindowUnderCursorInfo := "ahk_id " Window "`n"
  106.       . "ahk_class " Class "`n"
  107.       . "title: " Title "`n"
  108.       . "control: " Control "`n"
  109.       . "PID: " PID "`n"
  110.       . "process name: " PName "`n"
  111.       . "top left (" WindowX ", " WindowY ")`n"
  112.       . "(width x height) (" Width " x " Height ")`n"
  113.       . "cursor's window position (" CursorX-WindowX ", " CursorY-WindowY ")`n"
  114.       . "cursor's screen position (" CursorX ", " CursorY ")`n"
  115.       . "BGR color: " BGR_Color " (" HexToDec("0x" SubStr(BGR_Color, 3, 2)) ", "
  116.       . HexToDec("0x" SubStr(BGR_Color, 5, 2)) ", "
  117.       . HexToDec("0x" SubStr(BGR_Color, 7, 2)) ")`n"
  118.    Return WindowUnderCursorInfo
  119. }
  120.  
  121. applog(text){ ;log to the application file
  122.     FormatTime, Time,, dd/MM/yyyy HH:mm:ss tt
  123.     FileAppend, %Time% %text%`n, %A_WorkingDir%\app.log
  124. }
  125.  
  126. ClickAtPos(x := 0, y := 0)
  127. {
  128.     MouseMove, x, y
  129.     Click
  130. }
Add Comment
Please, Sign In to add comment