Pause function not acting as intended

Get help with using AutoHotkey (v1.1 and older) and its commands and hotkeys
Monoxide3009
Posts: 65
Joined: 09 Apr 2018, 15:53

Pause function not acting as intended

Post by Monoxide3009 » 30 Jun 2022, 18:34

EDIT - I realized the why, but not the solution. Since its paused, hitting escape wont unpause it because there are other functions 'before' the pause function. Since it is already paused it wont progress. That said, I dont know a good way around this while also time stamping it with "paused/unpaused". Any suggestions?

Hey all,

I have some programs for work. For data metrics purposes, I added time stamps to certain functions. I intended to add a time stamp with a file append to my pause function so my boss can see when a program is stopped and resumed. Base function (without the tracking) works fine. However, once I added the tracking metrics, it will pause, but will not unpause once the key (escape) is pressed again. Standard goes, person hits escape it pauses, they hit escape again it resumes. The following alterations broke it and I dont grasp why:

Code: Select all

esc::
PAUSE_TIME := SubStr(A_NOW,-5,6)

if (PAUSED_STATUS = "")
{
	FileAppend, PAUSED.%PAUSE_TIME%`n, %FILE_LOCATION% ; Script started append
	PAUSED_STATUS = 1
	}
else if (PAUSED_STATUS = "1")
{
	FileAppend, UNPAUSED.%PAUSE_TIME%`n, %FILE_LOCATION% ; Script started append
	PAUSED_STATUS = ;
	}
	
Pause
Return
This is the working standard:

Code: Select all

esc::
Pause
Return

User avatar
mikeyww
Posts: 27049
Joined: 09 Sep 2014, 18:38

Re: Pause function not acting as intended

Post by mikeyww » 30 Jun 2022, 20:11

Code: Select all

Esc::
Pause,, 1
If A_IsPaused
     MsgBox, 48, Pause status, Paused
Else MsgBox, 64, Pause status, Not paused
Return

Post Reply

Return to “Ask for Help (v1)”