Page 1 of 1

Simple key to end process?

Posted: 24 May 2018, 19:16
by AnimeSan
Hello, I have the following simple script written:

Code: Select all

Loop {
	MouseMove, 1503,372
	Sleep, 100
	Click
	Sleep, 100
	Send ^v
	Sleep, 200
	Send {Enter}
	Sleep 400
	Send {Enter}
	Sleep 400
	Send {Enter}
	Sleep 100
}

And want to know how to make it so pressing Escape ends the script. I tried putting Esc::ExitApp in different locations but none of them worked properly.

Thanks in advance

Re: Simple key to end process?

Posted: 24 May 2018, 19:27
by TLM
AnimeSan wrote:I tried putting Esc::ExitApp in different locations...
Can you please explain what you mean by "different locations" ? It really should work

Re: Simple key to end process?

Posted: 25 May 2018, 11:05
by AnimeSan
I tried putting it before the loop, at the end of the loop, and right after the loop? putting it before didnt start the loop, putting it in the loop made the loop stop after one loop, and putting it after did not let me click escape to end the script.

Re: Simple key to end process?

Posted: 25 May 2018, 12:35
by TLM
Hotkeys themselves aren't to be placed within loops ( although the Hotkey command can be )
This works for me:

Code: Select all

Loop {
	MouseMove, 1503,372
	Sleep, 100
	Click
	Sleep, 100
	Send ^v
	Sleep, 200
	Send {Enter}
	Sleep 400
	Send {Enter}
	Sleep 400
	Send {Enter}
	Sleep 100
}
return ; << not necessarily needed in this case

Esc::ExitApp