Search code examples
mousemoveautohotkey

AutoHotkey push a button to move curser to the left


I am struggling to make an AutoHotkey script, if anyone would help I would appreciate it. the script im trying to make is: if I pressed F my mouse would move to the left as long as im pushing the F button from the current location I had my mouse on. This is what I have right now and it's not working.

Loop { Sleep 10 MouseGetPos,x if (MouseMove, -1000, 0, 100, R) send {C down} else if {C up} break } return Esc::ExitApp


Solution

  • Try this:

    f::MouseMove -5, 0, 50, R
    

    50 is the speed, and the R letter means that the offset is relative to the current cursor position. You don't need the loop, as the pressed key will generate subsequent events on its own.