Skip to content
TheChatArchiveThe Chat Archive
gpt-4o-2024-08-06· OpenAIAi2 WildChat-4.8M (AI2)

Creat a F7 function that will click on screencoord -650,200 #SingleInstance, Force…

  1. User

    Creat a F7 function that will click on screencoord -650,200 #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

    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 } }

  2. Assistant

    To create an F7 function in AutoHotkey to click on screen coordinates -650,200, you need to define that specific key action. Below is how you can integrate an F7 hotkey into your existing script:

    #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
    
    F7::ClickCoordinates
    
    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
        }
    }
    
    ClickCoordinates:
    {
        ; Calculate the absolute screen coordinates from the center
        ClickX := screencenterx - 650
        ClickY := screencentery + 200
    
        ; Perform the click at the specified coordinates
        Click, %ClickX%, %ClickY%
    }
    

    Explanation:

    • F7 Hotkey: The F7 key is assigned to execute the ClickCoordinates function. This function calculates the absolute screen coordinates by subtracting and adding the provided values (-650, 200) to the center of the screen and performs a mouse click at those coordinates.

    • ClickCoordinates Function: Within the ClickCoordinates function, ClickX and ClickY are calculated relative to the screen’s center (screencenterx and screencentery). The script then performs a click at these calculated coordinates.

    Ensure your script contains these definitions and the necessary pieces from your current script to operate correctly. This should satisfy the requirement to create a function that clicks at specified screen coordinates when F7 is pressed.