Page 1 of 1

Getting "pause" to work better

Posted: 02 Jul 2020, 12:03
by Phigl
Hi,

I have the following script which does what I need it to do, but hitting ctrl-z to pause only works sometimes. It's as if I have to be in the exact right part of the loop for it to work.

What can I change to make the "pause" function better?

Code: Select all

#NoEnv  ; Recommended for performance and compatibility with future AutoHotkey releases.
; #Warn  ; Enable warnings to assist with detecting common errors.
SendMode Input  ; Recommended for new scripts due to its superior speed and reliability.
SetWorkingDir %A_ScriptDir%  ; Ensures a consistent starting directory.

Pause On

Loop
{
Send,S 
sleep 75
Send,R  
sleep 75
Send,S  
sleep 150
Send,S  
sleep 75
Send,0  
sleep 75
}

ExitApp

^z::Pause
^x::ExitApp

Re: Getting "pause" to work better  Topic is solved

Posted: 02 Jul 2020, 12:58
by Rohwedder
Hallo,
I recommend the Pause key.
Single press: Pause off/on
Double press: ExitApp

Code: Select all

#NoEnv  ; Recommended for performance and compatibility with future AutoHotkey releases.
; #Warn  ; Enable warnings to assist with detecting common errors.
SendMode Input  ; Recommended for new scripts due to its superior speed and reliability.
SetWorkingDir %A_ScriptDir%  ; Ensures a consistent starting directory.
Pause On
Loop
{
	Send,S
	sleep 75
	Send,R
	sleep 75
	Send,S
	sleep 150
	Send,S
	sleep 75
	Send,0
	sleep 75
}
ExitApp

*Pause::
Pause,,1
IF (A_PriorHotkey = A_ThisHotkey And A_TimeSincePriorHotkey < 400)
	ExitApp
Return

Re: Getting "pause" to work better

Posted: 02 Jul 2020, 14:55
by Phigl
Rohwedder wrote:
02 Jul 2020, 12:58
Hallo,
I recommend the Pause key.
Single press: Pause off/on
Double press: ExitApp

Code: Select all

#NoEnv  ; Recommended for performance and compatibility with future AutoHotkey releases.
; #Warn  ; Enable warnings to assist with detecting common errors.
SendMode Input  ; Recommended for new scripts due to its superior speed and reliability.
SetWorkingDir %A_ScriptDir%  ; Ensures a consistent starting directory.
Pause On
Loop
{
	Send,S
	sleep 75
	Send,R
	sleep 75
	Send,S
	sleep 150
	Send,S
	sleep 75
	Send,0
	sleep 75
}
ExitApp

*Pause::
Pause,,1
IF (A_PriorHotkey = A_ThisHotkey And A_TimeSincePriorHotkey < 400)
	ExitApp
Return
Simple, thank you!