0
votes

Specifically I am trying to write a simple script for a Logitech mouse that uses Lua language.

The desired script is straightforward: Move the mouse down 1 pixel every 5 milliseconds and click mouse button 1 every 500 milliseconds.

The actions independent of each other are easy;

repeat
MoveMouseRelative(0,1)
Sleep (5)

repeat
PressMouseButton(1)
Sleep (500)

However, I am looking for a simple/elegant way to combine them into one loop. Any suggestions for a newbie?

1

1 Answers

0
votes

Well, the straightforward variant could be:

repeat
  for i=1,100 do
    MoveMouseRelative(0,1)
    Sleep(5)
  end
  PressMouseButton(1)
until false