Make sure Function F7 uses "WinMove" #SingleInstance, Force
#MaxThreadsPerHotkey 2
SetTitleMatchMode, 2  ; Allows partial matching of window titles
SetKeyDelay, -1

Global screencenterx := (A_ScreenWidth // 2)
Global screencentery := (A_ScreenHeight // 2)

; Simple Clicker
F5::Goto AFKCTest

F6::
ToolTip "GeForceNow Anti-AFK Enabled", 0, 0
Goto GeForceNowAntiAFK

; New F7 functionality - faster version
F7::
Send, f                ; Press "f"
Sleep, 100             ; Reduced delay
MouseMove, 1250, 200   ; Move cursor to coordinates (1250, 200)
Sleep, 50              ; Reduced delay
Click, Left            ; Left click
Sleep, 100             ; Reduced delay
Send, g                ; Type "g"
Sleep, 50              ; Reduced delay
Send, {Enter}          ; Press Enter
Sleep, 100             ; Reduced delay
MouseMove, 1427, 193   ; Move cursor to coordinates (1427, 193)
Sleep, 50              ; Reduced delay
Click, Left            ; Left click
Sleep, 100             ; Reduced delay
Send, {Enter}          ; Press Enter after left click
Sleep, 50              ; Reduced delay
MouseMove, 1250, 200   ; Move back to (1250, 200)
Sleep, 50              ; Reduced delay
Click, Left            ; Left click
Sleep, 100             ; Reduced delay
Send, y                ; Type "y"
Sleep, 50              ; Reduced delay
Send, {Enter}          ; Press Enter
Sleep, 100             ; Reduced delay
MouseMove, 1427, 193   ; Move to (1427, 193) again
Sleep, 50              ; Reduced delay
Click, Left            ; Left click
Sleep, 100             ; Reduced delay
Send, {Enter}          ; Press Enter after left click
Sleep, 50              ; Reduced delay
MouseMove, 1250, 200   ; Move back to (1250, 200)
Sleep, 50              ; Reduced delay
Click, Left            ; Left click
Sleep, 100             ; Reduced delay
Send, o                ; Type "o"
Sleep, 50              ; Reduced delay
Send, {Enter}          ; Press Enter
Sleep, 100             ; Reduced delay
MouseMove, 1427, 193   ; Move to (1427, 193) again
Sleep, 50              ; Reduced delay
Click, Left            ; Left click
Sleep, 100             ; Reduced delay
Send, {Enter}          ; Press Enter after left click
Sleep, 50              ; Reduced delay
MouseMove, 1250, 200   ; Move back to (1250, 200)
Sleep, 50              ; Reduced delay
Click, Left            ; Left click
Sleep, 100             ; Reduced delay
Send, h                ; Type "h"
Sleep, 50              ; Reduced delay
Send, {Enter}          ; Press Enter
Sleep, 100             ; Reduced delay
MouseMove, 1427, 193   ; Move to (1427, 193) again
Sleep, 50              ; Reduced delay
Click, Left            ; Left click
Sleep, 100             ; Reduced delay
Send, {Enter}          ; Press Enter after left click
Sleep, 50              ; Reduced delay
MouseMove, 1250, 200   ; Move back to (1250, 200)
Sleep, 50              ; Reduced delay
Click, Left            ; Left click
Sleep, 100             ; Reduced delay
Send, f                ; Type "f"
Sleep, 50              ; Reduced delay
Send, {Enter}          ; Press Enter
Sleep, 100             ; Reduced delay
MouseMove, 1427, 193   ; Move to (1427, 193) again
Sleep, 50              ; Reduced delay
Click, Left            ; Left click
Sleep, 100             ; Reduced delay
Send, {Enter}          ; Press Enter after left click
Send, {Esc}            ; Press Escape to close interface
Return

AFKCTest:
AFKCToggle := !AFKCToggle
Loop
{
    If not AFKCToggle
        break
    Sleep 100
    ControlClick, x%screencenterx% y%screencentery%, GeForce NOW,,,, D Pos
    ControlClick, x%screencenterx% y%screencentery%, GeForce NOW,,,, U Pos
}
Return

GeForceNowAntiAFK:
Gui, Submit, NoHide
SetTimer, GeForceNowAntiAFKLoop, 240000
Return

GeForceNowAntiAFKLoop()
{
    WinGetPos, X, Y, Width, Height, GeForce NOW
    if ErrorLevel = 0  ; Check if the window was found
    {
        Random, MoveAmount, 1, 3  ; Randomize movement to avoid detection
        WinMove, GeForce NOW,, X, Y + MoveAmount
        Sleep, 333
        WinMove, GeForce NOW,, X, Y
    }
    else
    {
        ToolTip "GeForce NOW window not found", 0, 0
    }
}