Edit script for function f7 to function on monitor 2 that is to the left by making it…
- User
Edit script for function f7 to function on monitor 2 that is to the left by making it temporarily active window first and then at the end return active window to monitor 1 #SingleInstance, Force #MaxThreadsPerHotkey 2 SetTitleMatchMode, 2 ; Allows partial matching of window titles SetKeyDelay, -1
; Get the dimensions of the first monitor SysGet, Monitor1, MonitorWorkArea, 1
; Simple Clicker F5::Goto AFKCTest
F6:: ToolTip, "GeForceNow Anti-AFK Enabled", 0, 0 Goto GeForceNowAntiAFK
; New F7 functionality - slower version F7:: Send, f ; Press "f" Sleep, 1000 ; Increased delay for visibility ; Calculate new coordinates relative to the first monitor MouseMove, Monitor1Left + 100, Monitor1Top + 200 ; Move cursor relative to the first monitor Sleep, 1000 ; Increased delay for visibility Click, Left ; Left click Sleep, 1000 ; Increased delay for visibility Send, g ; Type "g" Sleep, 1000 ; Increased delay for visibility Send, {Enter} ; Press Enter Sleep, 1000 ; Increased delay for visibility MouseMove, Monitor1Left + 150, Monitor1Top + 200 ; Move cursor to new coordinates on first monitor Sleep, 1000 ; Increased delay for visibility Click, Left ; Left click Sleep, 1000 ; Increased delay for visibility Send, {Enter} ; Press Enter after left click Sleep, 1000 ; Increased delay for visibility Send, {Esc} ; Press Escape to close interface Return
AFKCTest: AFKCToggle := !AFKCToggle Loop { If not AFKCToggle break Sleep, 1000 ; Increased delay for visibility ControlClick, x%Monitor1Left% x%Monitor1Top% y+%screencentery%, GeForce NOW,,,, D Pos Sleep, 500 ; Slight pause before releasing the click ControlClick, x%Monitor1Left% x%Monitor1Top% 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, 1000 ; Increased delay to observe the movement WinMove, GeForce NOW,, X, Y } else { ToolTip, "GeForce NOW window not found", 0, 0 }
- Assistant
To edit your script so that the function tied to
F7temporarily switches to a window on monitor 2 (which is to the left of monitor 1), performs its actions, and then returns back to the original active window on monitor 1, you can make use ofWinActivateandWinGetto manage active windows. Here's an updated version of your script with the necessary changes:#SingleInstance, Force #MaxThreadsPerHotkey 2 SetTitleMatchMode, 2 ; Allows partial matching of window titles SetKeyDelay, -1 ; Get the dimensions of the first and second monitor SysGet, Monitor1, MonitorWorkArea, 1 SysGet, Monitor2, MonitorWorkArea, 2 ; Simple Clicker F5::Goto AFKCTest F6:: ToolTip, "GeForceNow Anti-AFK Enabled", 0, 0 Goto GeForceNowAntiAFK ; New F7 functionality - slower version on monitor 2 F7:: ; Save the currently active window to restore it later WinGet, activeWindow, ID, A ; Move to and activate a window on monitor 2 ; Here you would need to adjust the criteria to select the correct window WinActivate, [Your Window Title on Monitor 2] ; Replace with actual window title Sleep, 500 ; Wait for the window to activate Send, {f} ; Press "f" Sleep, 1000 ; Increased delay for visibility ; Calculate new coordinates relative to the second monitor MouseMove, Monitor2Left + 100, Monitor2Top + 200 ; Move cursor relative to the second monitor Sleep, 1000 ; Increased delay for visibility Click, Left ; Left click Sleep, 1000 ; Increased delay for visibility Send, {g} ; Type "g" Sleep, 1000 ; Increased delay for visibility Send, {Enter} ; Press Enter Sleep, 1000 ; Increased delay for visibility MouseMove, Monitor2Left + 150, Monitor2Top + 200 ; Move cursor to new coordinates on second monitor Sleep, 1000 ; Increased delay for visibility Click, Left ; Left click Sleep, 1000 ; Increased delay for visibility Send, {Enter} ; Press Enter after left click Sleep, 1000 ; Increased delay for visibility Send, {Esc} ; Press Escape to close interface ; Return focus to the originally active window WinActivate, ahk_id %activeWindow% Return AFKCTest: AFKCToggle := !AFKCToggle Loop { If not AFKCToggle break Sleep, 1000 ; Increased delay for visibility ControlClick, x%Monitor1Left% y%Monitor1Top%, GeForce NOW,,,, D Pos Sleep, 500 ; Slight pause before releasing the click ControlClick, x%Monitor1Left% y%Monitor1Top%, 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, 1000 ; Increased delay to observe the movement WinMove, GeForce NOW,, X, Y } else { ToolTip, "GeForce NOW window not found", 0, 0 } }Key Changes:
- Window Management: The script now saves the current active window before switching and reactivates it afterward.
- Monitor Adjustments: Mouse movements are adjusted to be relative to the second monitor.
- Window Activation: The script uses
WinActivateto activate another window temporarily. Make sure to replace[Your Window Title on Monitor 2]with the actual title of the window you want to work with.
This adjusted script assumes that you have a specific window title or some method of identifying the window on monitor 2. Adjust the
WinActivateline according to your needs.