Auto Hot key uses window-relative coordinates, not screen-relative unless you explicitly set it
Try this v1 script:
#NoEnv
#SingleInstance Force
SendMode Input
CoordMode, Mouse, Screen
FileCreateDir, C:\data
; F1 starts loop
F1::
Loop
{
SendInput 1
Sleep, 500
Click
Sleep, 500
SendInput x
Sleep, 500
Click
Sleep, 500
SendInput e
Sleep, 500
MouseMove, 587, 593
Sleep, 500
Click
Sleep, 500
MouseMove, 600, 135
Sleep, 500
}
return
; F2 exits
F2::ExitApp
; F3 logs mouse pos + timestamp and beeps
F3::
MouseGetPos, xpos, ypos
FormatTime, timestamp,, yyyy-MM-dd HH:mm:ss
FileAppend, Screen %xpos%`,%ypos% - %timestamp%`r`n, C:\data\myclicks.txt
SoundBeep
return
https://www.autohotkey.com/docs/v2/lib/CoordMode.htm
The default coordinate system for many commands depends on the AutoHotkey version:
AutoHotkey v2: The default is Client, meaning coordinates are relative to the active window's client area (the part of the window that excludes the title bar and borders).
AutoHotkey v1: The default is Window (or ), where coordinates are relative to the active window, including its borders and title bar.
This is an outline for a v2 script:
#Requires AutoHotkey v2.0
SendMode "Input"
CoordMode "Mouse", "Screen"
; Ensure folder exists
if !DirExist("C:\data")
DirCreate("C:\data")
; F1 starts the infinite loop
F1::
{
Loop
{
Sleep(2500)
MouseMove(587, 593)
Sleep(500)
SoundBeep()
}
}
; F2 exits the script
F2::ExitApp()
; F3 logs mouse position + time
F3::
{
MouseGetPos(&xpos, &ypos)
timestamp := FormatTime(, "yyyy-MM-dd HH:mm:ss")
FileAppend("Screen " xpos "," ypos " - " timestamp "`r`n", "C:\data\myclicks.txt")
SoundBeep()
}
Note: Feel free to customize the folder where you save the clicks by changing C:\data in the top and bottom of script
MouseMovedo anything? E.g.:MouseMove, 587, 593, 10(10 = speed (1-100), the higher the number, the slower the movement).