By using the following, when a key is pressed, the window will be activated, and you won't need to click on other windows
; Initialize variables clicking := false clickInterval := 20 ; Click interval (in milliseconds) windowActivated := false ; Flag to activate the window only once ; High-speed click settings SetBatchLines, -1 ; Run the script at maximum speed SetMouseDelay, 1 ; Set the delay time between mouse events (in milliseconds) ; Start actions when the L key is pressed L:: clicking := true Loop { ; Activate the window only once on the first loop iteration if (!windowActivated) { ActivateWindowAndMoveCursor("VRChat") ; Activate the window and move the cursor windowActivated := true ; Set the flag to call this function only once during the first loop } if (!clicking) break ; Simulate rapid left-clicking Click, Down ; Simulate pressing down the left mouse button Sleep, clickInterval ; Adjust click speed (interval) Click, Up ; Simulate releasing the left mouse button } return ; Stop clicking when the L key is released L up:: clicking := false windowActivated := false ; Reset the window activation flag return ; Method to activate the VRChat window and move the cursor to its center ActivateWindowAndMoveCursor(windowTitle) { ; Check if the window exists and activate it IfWinExist, %windowTitle% ; Check for the specified window title { ; Activate the window WinActivate, %windowTitle% ; Get the window's position and size WinGetPos, x, y, width, height, %windowTitle% ; Calculate the center of the window (using integer division) centerX := x + (width // 2) centerY := y + (height // 2) ; Move the cursor to the center of the window MouseMove, centerX, centerY } else { MsgBox, %windowTitle% not found. Please check if the window is running. } }