Global primaryMonitorWidth := 1920 ; Width of primary monitor
Global secondMonitorWidth := 1920 ; Width of second monitor (might be different if you're using different resolutions)
Global secondMonitorHeight := 1080 ; Height of second monitor
Global screencenterx := -(secondMonitorWidth // 2) ; Center x of the second monitor to the left
Global screencentery := (secondMonitorHeight // 2) ; Center y of the second monitor
GeForceNowAntiAFKLoop()
{
WinGetPos, X, Y, Width, Height, GeForce NOW
if ErrorLevel = 0
{
WinMove, GeForce NOW,, X, Y + 1
Sleep, 333
WinMove, GeForce NOW,, X, Y
}
}
SecondMonitorAndActivate:
MouseMove, %screencenterx%, %screencentery% ; Move mouse to center of the second monitor
WinActivate, GeForce NOW ; Activate GeForce NOW window
MouseMove, -650, 200 ; Move cursor to coordinates (-650, 200)
Send, f ; Press "f"
Sleep, 300 ; Reduced delay
MouseMove, -650, 200 ; Move cursor to coordinates (-650, 200)
Sleep, 100 ; 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, -500, 193 ; Move cursor to coordinates (-500, 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, -650, 200 ; Move back to (-650, 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, -500, 193 ; Move to (-500, 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, -650, 200 ; Move back to (-650, 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, -500, 193 ; Move to (-500, 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, -650, 200 ; Move back to (-650, 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, -500, 193 ; Move to (-500, 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, -650, 200 ; Move back to (-650, 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, -500, 193 ; Move to (-500, 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
MouseMove, 1250, 200 ; Move back to (1250, 200)
Click, Left ; Left click
Return
Assistant
To make the F7 function return to the main monitor at the end, you can update the SecondMonitorAndActivate function to include a final section that moves the cursor to the primary monitor and activates a window on that monitor (if needed). Here is an updated version of the script:
autohotkey
User
When i return to the primary monitor i want activate the ark ascended title
Assistant
To return to the primary monitor and activate the "ARK: Ascended" window, you simply need to use the WinActivate command with the window title. Assuming you want to activate a window with the title "ARK: Ascended", you can implement it like this:
autohotkey
User
Add a new function when i press F8 that will keep clicking "e"
Assistant
To add a new function triggered by pressing F8 that continuously sends the "e" key, you can create a loop similar to the AFKCTest function. Here's how you can implement this new functionality:
autohotkey
User
Edit the script so that function F7 occurs while I am still using main monitor
Assistant
To modify the script so that the actions in the SecondMonitorAndActivate function occur while you are still able to use the main monitor without being interrupted, you can leverage creating a new thread with SetTimer. This way, the F7 function executes in the background, allowing you to continue using the main monitor with minimal interference. Here's how to modify the script accordingly:
autohotkey
User
Edit the script so that Function F7 does not need to use main monitor mouse and keyboard
Assistant
To ensure that the F7 function performs its actions on the second monitor without interfering with the main monitor's mouse and keyboard usage, we can make use of ControlSend and ControlClick. These functions allow you to send keystrokes and clicks directly to a specific window, rather than relying on mouse movements and keyboard inputs that impact the entire system. Here's how you can modify the script accordingly:
autohotkey
User
Add a ControlClick of (-650,200) to the F7 function
Assistant
To add a ControlClick action at the coordinates (-650, 200) to the F7 function, you can utilize the ControlClick command within the SecondMonitorAndActivate function. This is contingent on selecting the "GeForce NOW" window and ensuring the action doesn't affect the main monitor’s functionality. Here's the revised script:
autohotkey
User
The F7 command is not activating the second monitor #SingleInstance, Force
#MaxThreadsPerHotkey 2
Global primaryMonitorWidth := 1920 ; Width of primary monitor
Global secondMonitorWidth := 1920 ; Width of second monitor (might be different if you're using different resolutions)
Global secondMonitorHeight := 1080 ; Height of second monitor
GeForceNowAntiAFKLoop()
{
WinGetPos, X, Y, Width, Height, GeForce NOW
if ErrorLevel = 0
{
WinMove, GeForce NOW,, X, Y + 1
Sleep, 333
WinMove, GeForce NOW,, X, Y
}
}
SecondMonitorAndActivate:
ControlFocus, , GeForce NOW ; Focus the GeForce NOW window
ControlSend, , f, GeForce NOW ; Send "f"
Sleep, 300 ; Reduced delay
ControlClick, x1250 y200, GeForce NOW,,,, Pos ; Click at (1250, 200)
Sleep, 100
ControlSend, , g, GeForce NOW ; Send "g"
Sleep, 100 ; Reduced delay
ControlSend, , {Enter}, GeForce NOW ; Send Enter
Sleep, 100 ; Reduced delay
ControlClick, x1430 y200, GeForce NOW,,,, Pos ; Click at (-500, 200)
Sleep, 100
ControlSend, , {Enter}, GeForce NOW ; Send Enter
Sleep, 100
ControlClick, x1250 y200, GeForce NOW,,,, Pos ; Click at (1250, 200)
Sleep, 100
ControlSend, , y, GeForce NOW ; Send "y"
Sleep, 100 ; Reduced delay
ControlSend, , {Enter}, GeForce NOW ; Send Enter
Sleep, 100 ; Reduced delay
ControlClick, x1430 y200, GeForce NOW,,,, Pos ; Click at (-500, 200)
Sleep, 100
ControlSend, , {Enter}, GeForce NOW ; Send Enter
Sleep, 100
ControlClick, x1250 y200, GeForce NOW,,,, Pos ; Click at (1250, 200)
Sleep, 100
ControlSend, , o, GeForce NOW ; Send "o"
Sleep, 100 ; Reduced delay
ControlSend, , {Enter}, GeForce NOW ; Send Enter
Sleep, 100 ; Reduced delay
ControlClick, x1430 y200, GeForce NOW,,,, Pos ; Click at (-500, 200)
Sleep, 100
ControlSend, , {Enter}, GeForce NOW ; Send Enter
Sleep, 100
ControlClick, x1250 y200, GeForce NOW,,,, Pos ; Click at (1250, 200)
Sleep, 100
ControlSend, , h, GeForce NOW ; Send "h"
Sleep, 100 ; Reduced delay
ControlSend, , {Enter}, GeForce NOW ; Send Enter
Sleep, 100 ; Reduced delay
ControlClick, x1430 y200, GeForce NOW,,,, Pos ; Click at (-500, 200)
Sleep, 100
ControlSend, , {Enter}, GeForce NOW ; Send Enter
Sleep, 100
ControlClick, x1250 y200, GeForce NOW,,,, Pos ; Click at (1250, 200)
Sleep, 100
ControlSend, , f, GeForce NOW ; Send "f"
Sleep, 100 ; Reduced delay
ControlSend, , {Enter}, GeForce NOW ; Send Enter
Sleep, 100 ; Reduced delay
ControlClick, x1430 y200, GeForce NOW,,,, Pos ; Click at (-500, 200)
Sleep, 100
ControlSend, , {Enter}, GeForce NOW ; Send Enter
Sleep, 100
ControlSend, , {Esc}, GeForce NOW ; Send Escape to close interface
Assistant
To ensure the F7 function activates the "GeForce NOW" window correctly on the second monitor, let's address a few common issues and optimize the script to enhance its reliability:
Ensure Window Activation: Verify that the correct instance of "GeForce NOW" is being referenced. Sometimes, windows require additional specifications to be correctly focused or activated.
Coordinate References: If your coordinates for ControlClick might be incorrect due to differences in screen setup, it's essential to reference relative coordinates within the window instead of absolute screen positions.
Here's how to revise the F7 functionality, focusing on making sure “GeForce NOW” becomes the active window without user interaction via the main monitor:
autohotkey
Not yet included in a published release.
#SingleInstance, Force
#MaxThreadsPerHotkey 2
SetTitleMatchMode, 2
SetKeyDelay, -1
CoordMode, Mouse, Screen
Global primaryMonitorWidth := 1920 ; Width of primary monitor
Global secondMonitorWidth := 1920 ; Width of second monitor (might be different if you're using different resolutions)
Global secondMonitorHeight := 1080 ; Height of second monitor
Global screencenterx := -(secondMonitorWidth // 2) ; Center x of the second monitor to the left
Global screencentery := (secondMonitorHeight // 2) ; Center y of the second monitor
F5::
Goto AFKCTest
F6::
ToolTip, GeForceNow Anti-AFK Enabled, 0, 0
Goto GeForceNowAntiAFK
F7::
Goto SecondMonitorAndActivate
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
{
WinMove, GeForce NOW,, X, Y + 1
Sleep, 333
WinMove, GeForce NOW,, X, Y
}
}
SecondMonitorAndActivate:
MouseMove, %screencenterx%, %screencentery% ; Move mouse to center of the second monitor
WinActivate, GeForce NOW ; Activate GeForce NOW window
MouseMove, -650, 200 ; Move cursor to coordinates (-650, 200)
Send, f ; Press "f"
Sleep, 300 ; Reduced delay
MouseMove, -650, 200 ; Move cursor to coordinates (-650, 200)
Sleep, 100 ; 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, -500, 193 ; Move cursor to coordinates (-500, 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, -650, 200 ; Move back to (-650, 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, -500, 193 ; Move to (-500, 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, -650, 200 ; Move back to (-650, 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, -500, 193 ; Move to (-500, 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, -650, 200 ; Move back to (-650, 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, -500, 193 ; Move to (-500, 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, -650, 200 ; Move back to (-650, 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, -500, 193 ; Move to (-500, 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
MouseMove, 1250, 200 ; Move back to (1250, 200)
Click, Left ; Left click
; Return to primary monitor
; If you want to activate a specific window on the primary monitor, specify its title here
primaryMonitorCenterX := primaryMonitorWidth // 2
primaryMonitorCenterY := secondMonitorHeight // 2 ; assuming the same height
MouseMove, %primaryMonitorCenterX%, %primaryMonitorCenterY%, 0
;WinActivate, SomePrimaryMonitorWindow ; Optionally activate a window on the primary monitor
Return
This script moves the cursor back to the center of the primary monitor as the final step in the SecondMonitorAndActivate function. If you wish to activate a specific window on the primary monitor after the operation, you can uncomment and modify the winactivate command to specify the desired window title. Adjust the primaryMonitorWidth and primaryMonitorCenterX/Y variables as needed based on your actual setup.
#SingleInstance, Force
#MaxThreadsPerHotkey 2
SetTitleMatchMode, 2
SetKeyDelay, -1
CoordMode, Mouse, Screen
Global primaryMonitorWidth := 1920 ; Width of primary monitor
Global secondMonitorWidth := 1920 ; Width of second monitor (might be different if you're using different resolutions)
Global secondMonitorHeight := 1080 ; Height of second monitor
Global screencenterx := -(secondMonitorWidth // 2) ; Center x of the second monitor to the left
Global screencentery := (secondMonitorHeight // 2) ; Center y of the second monitor
F5::
Goto AFKCTest
F6::
ToolTip, GeForceNow Anti-AFK Enabled, 0, 0
Goto GeForceNowAntiAFK
F7::
Goto SecondMonitorAndActivate
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
{
WinMove, GeForce NOW,, X, Y + 1
Sleep, 333
WinMove, GeForce NOW,, X, Y
}
}
SecondMonitorAndActivate:
MouseMove, %screencenterx%, %screencentery% ; Move mouse to center of the second monitor
WinActivate, GeForce NOW ; Activate GeForce NOW window
MouseMove, -650, 200 ; Move cursor to coordinates (-650, 200)
Send, f ; Press "f"
Sleep, 300 ; Reduced delay
MouseMove, -650, 200 ; Move cursor to coordinates (-650, 200)
Sleep, 100 ; 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, -500, 193 ; Move cursor to coordinates (-500, 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, -650, 200 ; Move back to (-650, 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, -500, 193 ; Move to (-500, 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, -650, 200 ; Move back to (-650, 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, -500, 193 ; Move to (-500, 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, -650, 200 ; Move back to (-650, 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, -500, 193 ; Move to (-500, 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, -650, 200 ; Move back to (-650, 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, -500, 193 ; Move to (-500, 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
MouseMove, 1250, 200 ; Move back to (1250, 200)
Click, Left ; Left click
; Return to primary monitor and activate "ARK: Ascended"
primaryMonitorCenterX := primaryMonitorWidth // 2
primaryMonitorCenterY := secondMonitorHeight // 2 ; assuming the same height
MouseMove, %primaryMonitorCenterX%, %primaryMonitorCenterY%, 0
WinActivate, ARK: Ascended
Return
This modified script ends the SecondMonitorAndActivate function by moving the cursor to the center of the primary monitor and activating the "ARK: Ascended" window. Adjust the window title as necessary if the window title on your system is different.
#SingleInstance, Force
#MaxThreadsPerHotkey 2
SetTitleMatchMode, 2
SetKeyDelay, -1
CoordMode, Mouse, Screen
Global primaryMonitorWidth := 1920 ; Width of primary monitor
Global secondMonitorWidth := 1920 ; Width of second monitor (might be different if you're using different resolutions)
Global secondMonitorHeight := 1080 ; Height of second monitor
Global screencenterx := -(secondMonitorWidth // 2) ; Center x of the second monitor to the left
Global screencentery := (secondMonitorHeight // 2) ; Center y of the second monitor
F5::
Goto AFKCTest
F6::
ToolTip, GeForceNow Anti-AFK Enabled, 0, 0
Goto GeForceNowAntiAFK
F7::
Goto SecondMonitorAndActivate
F8::
Goto ContinuousEKey
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
{
WinMove, GeForce NOW,, X, Y + 1
Sleep, 333
WinMove, GeForce NOW,, X, Y
}
}
SecondMonitorAndActivate:
MouseMove, %screencenterx%, %screencentery% ; Move mouse to center of the second monitor
WinActivate, GeForce NOW ; Activate GeForce NOW window
MouseMove, -650, 200 ; Move cursor to coordinates (-650, 200)
Send, f ; Press "f"
Sleep, 300 ; Reduced delay
MouseMove, -650, 200 ; Move cursor to coordinates (-650, 200)
Sleep, 100 ; 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, -500, 193 ; Move cursor to coordinates (-500, 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, -650, 200 ; Move back to (-650, 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, -500, 193 ; Move to (-500, 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, -650, 200 ; Move back to (-650, 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, -500, 193 ; Move to (-500, 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, -650, 200 ; Move back to (-650, 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, -500, 193 ; Move to (-500, 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, -650, 200 ; Move back to (-650, 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, -500, 193 ; Move to (-500, 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
MouseMove, 1250, 200 ; Move back to (1250, 200)
Click, Left ; Left click
; Return to primary monitor and activate "ARK: Ascended"
primaryMonitorCenterX := primaryMonitorWidth // 2
primaryMonitorCenterY := secondMonitorHeight // 2 ; assuming the same height
MouseMove, %primaryMonitorCenterX%, %primaryMonitorCenterY%, 0
WinActivate, ARK: Ascended
Return
ContinuousEKey:
EKeyToggle := !EKeyToggle
loop
{
If not EKeyToggle
break
Send, e
Sleep, 100 ; Adjust the delay between key presses as needed
}
return
Explanation:
F8: This hotkey triggers the ContinuousEKey label.
EKeyToggle: This variable is toggled each time F8 is pressed, switching between starting and stopping the e key sending loop.
Loop: Inside this loop, the script continuously sends the "e" key as long as EKeyToggle remains true.
Sleep: The sleep duration determines how fast the "e" key is sent repeatedly. You can adjust this value based on your requirements.
By pressing F8 again, you can toggle the function off, stopping the repeated sending of the "e" key.
#SingleInstance, Force
#MaxThreadsPerHotkey 2
SetTitleMatchMode, 2
SetKeyDelay, -1
CoordMode, Mouse, Screen
Global primaryMonitorWidth := 1920 ; Width of primary monitor
Global secondMonitorWidth := 1920 ; Width of second monitor (might be different if you're using different resolutions)
Global secondMonitorHeight := 1080 ; Height of second monitor
Global screencenterx := -(secondMonitorWidth // 2) ; Center x of the second monitor to the left
Global screencentery := (secondMonitorHeight // 2) ; Center y of the second monitor
F5::
Goto AFKCTest
F6::
ToolTip, GeForceNow Anti-AFK Enabled, 0, 0
Goto GeForceNowAntiAFK
F7::
ToolTip, Activating GeForce NOW on Second Monitor, 0, 0
SetTimer, SecondMonitorAndActivate, -1
Return
F8::
Goto ContinuousEKey
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
{
WinMove, GeForce NOW,, X, Y + 1
Sleep, 333
WinMove, GeForce NOW,, X, Y
}
}
SecondMonitorAndActivate:
MouseMove, %screencenterx%, %screencentery% ; Move mouse to center of the second monitor
WinActivate, GeForce NOW ; Activate GeForce NOW window
MouseMove, -650, 200 ; Move cursor to coordinates (-650, 200)
Send, f ; Press "f"
Sleep, 300 ; Reduced delay
MouseMove, -650, 200 ; Move cursor to coordinates (-650, 200)
Sleep, 100 ; 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, -500, 193 ; Move cursor to coordinates (-500, 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, -650, 200 ; Move back to (-650, 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, -500, 193 ; Move to (-500, 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, -650, 200 ; Move back to (-650, 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, -500, 193 ; Move to (-500, 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, -650, 200 ; Move back to (-650, 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, -500, 193 ; Move to (-500, 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, -650, 200 ; Move back to (-650, 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, -500, 193 ; Move to (-500, 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
MouseMove, 1250, 200 ; Move back to (1250, 200)
Click, Left ; Left click
; Notify that actions on the second monitor are complete
ToolTip, Second monitor actions complete!, 0, 0
Sleep, 2000
ToolTip ; Turn off tooltip
Return
ContinuousEKey:
EKeyToggle := !EKeyToggle
loop
{
If not EKeyToggle
break
Send, e
Sleep, 100 ; Adjust the delay between key presses as needed
}
return
Key Modifications:
SetTimer, SecondMonitorAndActivate, -1: This starts the SecondMonitorAndActivate function in a separate thread, meaning the script runs these activities in the background, allowing you to continue using your primary monitor normally.
ToolTip: Added a tooltip when F7 is pressed to show that the background process is starting, and another tooltip at the end of SecondMonitorAndActivate to indicate the completion of actions on the second monitor.
This configuration allows simultaneous interaction with the main monitor while the automation for GeForce NOW is processing on the second monitor. Adjust the delay or other actions as needed based on specific requirements.
#SingleInstance, Force
#MaxThreadsPerHotkey 2
SetTitleMatchMode, 2
SetKeyDelay, -1
CoordMode, Mouse, Screen
Global primaryMonitorWidth := 1920 ; Width of primary monitor
Global secondMonitorWidth := 1920 ; Width of second monitor (might be different if you're using different resolutions)
Global secondMonitorHeight := 1080 ; Height of second monitor
F5::
Goto AFKCTest
F6::
ToolTip, GeForceNow Anti-AFK Enabled, 0, 0
Goto GeForceNowAntiAFK
F7::
ToolTip, Activating GeForce NOW on Second Monitor, 0, 0
SetTimer, SecondMonitorAndActivate, -1
Return
F8::
Goto ContinuousEKey
AFKCTest:
AFKCToggle := !AFKCToggle
loop
{
If not AFKCToggle
break
Sleep 100
ControlClick, , GeForce NOW,,,, D Pos
ControlClick, , GeForce NOW,,,, U Pos
}
return
GeForceNowAntiAFK:
Gui, Submit, NoHide
SetTimer, GeForceNowAntiAFKLoop, 240000
return
GeForceNowAntiAFKLoop()
{
WinGetPos, X, Y, Width, Height, GeForce NOW
if ErrorLevel = 0
{
WinMove, GeForce NOW,, X, Y + 1
Sleep, 333
WinMove, GeForce NOW,, X, Y
}
}
SecondMonitorAndActivate:
ControlFocus, , GeForce NOW ; Focus the GeForce NOW window
ControlSend, , f, GeForce NOW ; Send "f"
Sleep, 300 ; Reduced delay
ControlSend, , g, GeForce NOW ; Send "g"
Sleep, 50 ; Reduced delay
ControlSend, , {Enter}, GeForce NOW ; Send Enter
Sleep, 100 ; Reduced delay
ControlSend, , y, GeForce NOW ; Send "y"
Sleep, 50 ; Reduced delay
ControlSend, , {Enter}, GeForce NOW ; Send Enter
Sleep, 100 ; Reduced delay
ControlSend, , o, GeForce NOW ; Send "o"
Sleep, 50 ; Reduced delay
ControlSend, , {Enter}, GeForce NOW ; Send Enter
Sleep, 100 ; Reduced delay
ControlSend, , h, GeForce NOW ; Send "h"
Sleep, 50 ; Reduced delay
ControlSend, , {Enter}, GeForce NOW ; Send Enter
Sleep, 100 ; Reduced delay
ControlSend, , f, GeForce NOW ; Send "f"
Sleep, 50 ; Reduced delay
ControlSend, , {Enter}, GeForce NOW ; Send Enter
Sleep, 100 ; Reduced delay
ControlSend, , {Esc}, GeForce NOW ; Send Escape to close interface
; Notify that actions on the second monitor are complete
ToolTip, Second monitor actions complete!, 0, 0
Sleep, 2000
ToolTip ; Turn off tooltip
Return
ContinuousEKey:
EKeyToggle := !EKeyToggle
loop
{
If not EKeyToggle
break
Send, e
Sleep, 100 ; Adjust the delay between key presses as needed
}
return
Key Modifications:
ControlSend: This is used to send keystrokes directly to the "GeForce NOW" window, bypassing the need for the active keyboard that might affect your current interactions on the main monitor.
ControlFocus: This is used to ensure that the "GeForce NOW" window is focused before sending the keys, ensuring the intended window receives the commands.
These modifications allow the script to control the "GeForce NOW" application only, without taking over your primary input devices on the main monitor. Note that ControlSend may not work with all applications, depending on how they handle inputs, especially in games or applications that use DirectX, where alternative solutions may be necessary.
#SingleInstance, Force
#MaxThreadsPerHotkey 2
SetTitleMatchMode, 2
SetKeyDelay, -1
CoordMode, Mouse, Screen
Global primaryMonitorWidth := 1920 ; Width of primary monitor
Global secondMonitorWidth := 1920 ; Width of second monitor (might be different if you're using different resolutions)
Global secondMonitorHeight := 1080 ; Height of second monitor
F5::
Goto AFKCTest
F6::
ToolTip, GeForceNow Anti-AFK Enabled, 0, 0
Goto GeForceNowAntiAFK
F7::
ToolTip, Activating GeForce NOW on Second Monitor, 0, 0
SetTimer, SecondMonitorAndActivate, -1
Return
F8::
Goto ContinuousEKey
AFKCTest:
AFKCToggle := !AFKCToggle
loop
{
If not AFKCToggle
break
Sleep 100
ControlClick, , GeForce NOW,,,, D Pos
ControlClick, , GeForce NOW,,,, U Pos
}
return
GeForceNowAntiAFK:
Gui, Submit, NoHide
SetTimer, GeForceNowAntiAFKLoop, 240000
return
GeForceNowAntiAFKLoop()
{
WinGetPos, X, Y, Width, Height, GeForce NOW
if ErrorLevel = 0
{
WinMove, GeForce NOW,, X, Y + 1
Sleep, 333
WinMove, GeForce NOW,, X, Y
}
}
SecondMonitorAndActivate:
ControlFocus, , GeForce NOW ; Focus the GeForce NOW window
; Perform ControlClick at (-650, 200)
ControlClick, x-650 y200, GeForce NOW,,,, Pos ; Click at (-650, 200)
ControlSend, , f, GeForce NOW ; Send "f"
Sleep, 300 ; Reduced delay
ControlSend, , g, GeForce NOW ; Send "g"
Sleep, 50 ; Reduced delay
ControlSend, , {Enter}, GeForce NOW ; Send Enter
Sleep, 100 ; Reduced delay
ControlSend, , y, GeForce NOW ; Send "y"
Sleep, 50 ; Reduced delay
ControlSend, , {Enter}, GeForce NOW ; Send Enter
Sleep, 100 ; Reduced delay
ControlSend, , o, GeForce NOW ; Send "o"
Sleep, 50 ; Reduced delay
ControlSend, , {Enter}, GeForce NOW ; Send Enter
Sleep, 100 ; Reduced delay
ControlSend, , h, GeForce NOW ; Send "h"
Sleep, 50 ; Reduced delay
ControlSend, , {Enter}, GeForce NOW ; Send Enter
Sleep, 100 ; Reduced delay
ControlSend, , f, GeForce NOW ; Send "f"
Sleep, 50 ; Reduced delay
ControlSend, , {Enter}, GeForce NOW ; Send Enter
Sleep, 100 ; Reduced delay
ControlSend, , {Esc}, GeForce NOW ; Send Escape to close interface
; Notify that actions on the second monitor are complete
ToolTip, Second monitor actions complete!, 0, 0
Sleep, 2000
ToolTip ; Turn off tooltip
Return
ContinuousEKey:
EKeyToggle := !EKeyToggle
loop
{
If not EKeyToggle
break
Send, e
Sleep, 100 ; Adjust the delay between key presses as needed
}
return
Modifications:
ControlClick, x-650 y200, GeForce NOW,,,, Pos: This sends a mouse click directly to the coordinates (-650, 200) inside the "GeForce NOW" window. The Pos option ensures the click is placed based on a relative position within the window.
This modification assumes that "GeForce NOW" window can accept control-based inputs and that the window is properly identified by its title. You might need to tweak the window specification (WinTitle) if the application title differs on your system.
code
; Notify that actions on the second monitor are complete
ToolTip, Second monitor actions complete!, 0, 0
Sleep, 2000
ToolTip ; Turn off tooltip
Return
ContinuousEKey:
EKeyToggle := !EKeyToggle
loop
{
If not EKeyToggle
break
Send, e
Sleep, 100 ; Adjust the delay between key presses as needed
}
return
#SingleInstance, Force
#MaxThreadsPerHotkey 2
SetTitleMatchMode, 2
SetKeyDelay, -1
CoordMode, Mouse, Screen
Global primaryMonitorWidth := 1920 ; Width of primary monitor
Global secondMonitorWidth := 1920 ; Width of second monitor (might be different if you're using different resolutions)
Global secondMonitorHeight := 1080 ; Height of second monitor
F5::
Goto AFKCTest
F6::
ToolTip, GeForceNow Anti-AFK Enabled, 0, 0
Goto GeForceNowAntiAFK
F7::
ToolTip, Activating GeForce NOW on Second Monitor, 0, 0
SetTimer, SecondMonitorAndActivate, -1
Return
F8::
Goto ContinuousEKey
AFKCTest:
AFKCToggle := !AFKCToggle
loop
{
If not AFKCToggle
break
Sleep 100
ControlClick, , GeForce NOW,,,, D Pos
ControlClick, , GeForce NOW,,,, U Pos
}
return
GeForceNowAntiAFK:
Gui, Submit, NoHide
SetTimer, GeForceNowAntiAFKLoop, 240000
return
GeForceNowAntiAFKLoop()
{
WinGetPos, X, Y, Width, Height, GeForce NOW
if ErrorLevel = 0
{
WinMove, GeForce NOW,, X, Y + 1
Sleep, 333
WinMove, GeForce NOW,, X, Y
}
}
SecondMonitorAndActivate:
; Retrieve the Unique Window ID
WinGet, GeForceNOWID, ID, GeForce NOW
if !GeForceNOWID
{
MsgBox, GeForce NOW window not found!
return
}
; Apply actions to GeForce NOW window
ControlFocus,, ahk_id %GeForceNOWID% ; Focus on GeForce NOW window
WinActivate, ahk_id %GeForceNOWID% ; Ensure it's the active window
; Perform ControlClick at relative coordinates to your second monitor
ControlClick, x1250 y200, ahk_id %GeForceNOWID%,,, Pos ; Click at relative position
Sleep, 100
ControlSend,, f, ahk_id %GeForceNOWID% ; Send "f"
Sleep, 100
ControlSend,, g, ahk_id %GeForceNOWID% ; Send "g"
Sleep, 100
ControlSend,, {Enter}, ahk_id %GeForceNOWID% ; Send Enter
Sleep, 100
ControlClick, x1430 y200, ahk_id %GeForceNOWID%,,, Pos ; Click another relative position
Sleep, 100
ControlSend,, {Enter}, ahk_id %GeForceNOWID% ; Send Enter
; Perform additional actions as needed in sequence
; You repeat similar steps for 'y', 'o', 'h', 'f' as shown, with equivalent click positions
ControlSend,, {Esc}, ahk_id %GeForceNOWID% ; Send Escape after operations
; Notify that actions on the second monitor are complete
ToolTip, Second monitor actions complete!, 0, 0
Sleep, 2000
ToolTip ; Turn off tooltip
Return
ContinuousEKey:
EKeyToggle := !EKeyToggle
loop
{
If not EKeyToggle
break
Send, e
Sleep, 100 ; Adjust the delay between key presses as needed
}
return
Key Thoughts:
Window Identification: The use of WinGet, GeForceNOWID, ID, GeForce NOW ensures that you operate on the precise window instance, providing more reliability when interacting with "GeForce NOW".
Direct Activation and Focus: By using ahk_id %GeForceNOWID%, you can instruct AutoHotkey to focus and activate the exact window, which can help systems where window titles are not being detected by name as expected.
Feedback: Use of MsgBox to provide user feedback in case the window is not found might be a helpful diagnostic tool when testing.