I am trying to move the mouse every 2 minutes so that the session doesn't time out. But despite no syntax errors, it doesn't work.
My code:
global $x = 1
global $y = 1
If Mod(@MIN, 3) = 0 Then
MouseMove (global $x, global $y, 2)
global $x++
global $y++
endif
Its more usefull to perform a callback function for timed calls.
AdlibRegister('_MouseMove', 2000*60) ; calls the function every 2000*60 ms
OnAutoItExitRegister('_UnRegister') ; unregister the callback function when the script ends
Func _MouseMove()
Local $aPos = MouseGetPos()
; move 1px right and back after a short brake - so that your interface can detect the movement
MouseMove($aPos[0]+1, $aPos[1])
Sleep(50)
MouseMove($aPos[0], $aPos[1])
EndFunc
Func _UnRegister()
AdlibUnRegister('_MouseMove')
EndFunc
Btw.: Increasing values with AutoIt works so
$x += 1
Edit: I'm not sure, if you want 2 or 3 minutes (you've written both). So you can change it in the time parameter in AdlibRegister(). The interval must given in ms.