Skip to content

Instantly share code, notes, and snippets.

@ethaniel
Last active October 19, 2022 13:33
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ethaniel/e4844f87c632928a17845f8f35fc31cc to your computer and use it in GitHub Desktop.
Save ethaniel/e4844f87c632928a17845f8f35fc31cc to your computer and use it in GitHub Desktop.
AutoHotKey script to minimize the TeamViewer side panel when I connect to a computer
; Save this file somewhere (I keep it on my desktop) as min_teamviewer.ahk and run it once
; It will create a shortcut in the Startup folder, so it will be loaded automatically on system reboot
#SingleInstance Force
;LWin::
;RWin::
DetectHiddenText, on
; the line below adds a shortcut to the script in the Startup folder, so it starts automatically when the computer restarts
FileCreateShortcut, %A_ScriptFullPath%, %A_Startup%\My AHK Script.lnk, %A_ScriptDir%
Loop
{
; Wait for the side panel to appear (it has ahk_class of TV_ControlWin, can check with Window Spy tool).
WinWait, ahk_class TV_ControlWin,, 1
if ErrorLevel
{
} else {
; Get width of the side panel
WinGetPos, , , Width, , ahk_class TV_ControlWin
; If width is more than 200 pixels, it means that the side panel is shown
IfGreater, Width, 200
{
; Click on the button (Window Spy says that it has ClassNN of Button9) to minimize the panel (makes it slide to the right)
ControlClick, Button9, ahk_class TV_ControlWin
}
}
; Sleep 3 seconds
Sleep, 3000
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment