Essentially, I have a program that is meant to detect when the user physically clicks, take a pair of coordinates from a text file, and then virtually click the mouse at those coordinates. These coordinates are just two numbers in a text file, separated by a newline, e.g.:
100
200
My problem is, I can't seem to get this pair of coordinates to load into the mouseCoords array. They just aren't pushed to it at all. I don't know if this is a problem with my Loop statement or my mouseCoords.Push(A_LoopReadLine) statement, but I have tried for hours and I just can't seem to get it to work. Can anyone help to fix?
Code: Select all
CoordMode, Mouse
physClick = False
LButton::
GetKeyState, State, LButton, P
If State = D
physClick = True
return
LButton Up::
If physClick = True
mouseCoords := []
Loop, Read, mousepos.txt
{
mouseCoords.Push(A_LoopReadLine)
}
physClick = False
Send {Click, mouseCoords[1], mouseCoords[2]}
return
!z::
ExitApp
return