Mouse movement while holding down a key

Get help with using AutoHotkey and its commands and hotkeys
Slash36
Posts: 1
Joined: 24 Apr 2019, 01:57

Mouse movement while holding down a key

24 Apr 2019, 02:01

Code: Select all

[Codebox=autohotkey file=Untitled.ahk]
[/Codebox]
I basically want to make my computer hold E, click on something, then release E. It also automatically closes after I'm I stop the code using F8 (not a huge issue) Here is the code:

#NoEnv
SetWorkingDir %A_ScriptDir%
CoordMode, Mouse, Screen
SendMode Input
#SingleInstance Force
SetTitleMatchMode 2
#WinActivateForce
SetControlDelay 1
SetWinDelay 0
SetKeyDelay -1
SetMouseDelay -1
SetBatchLines -1


F7::
Macro1:
Loop
{
Send {E Down}
Click, 1283, 719, 0
Click, 1283, 718, 0
Send {E Up}
Sleep, 15
Click, 1287, 718, 0
Send, {e}
Click, 1287, 717, 0
Osprey
Posts: 453
Joined: 18 Nov 2017, 05:50

Re: Mouse movement while holding down a key

24 Apr 2019, 17:12

Your code looks okay, except that your Macro1 subroutine has no end Return, your F7 hotkey has no end Return and your Loop has no end }, which may all have just been a copy-paste slip-up. As for interrupting the loop, try something like:

Code: Select all

F7::
  Abort := 0
  Loop
  {
    Send {E Down}
    Click, 1283, 719, 0
    Click, 1283, 718, 0
    Send {E Up}
    Sleep, 15
    Click, 1287, 718, 0
    Send, {e}
    Click, 1287, 717, 0Loop
  } Until Abort
Return

F8::Abort := 1

Return to “Ask For Help”

Who is online

Users browsing this forum: Google [Bot], Ortorin and 216 guests