How Can I Have a Script Detect If a SECOND Script Is Suspended

Get help with using AutoHotkey (v1.1 and older) and its commands and hotkeys
AlFlo
Posts: 345
Joined: 29 Nov 2021, 21:46

How Can I Have a Script Detect If a SECOND Script Is Suspended

Post by AlFlo » 27 Mar 2024, 03:18

My Autocorrect script contains a hotkey to toggle the script between active and suspended mode, and to show a tooltip as to the script's status:

Code: Select all

#a:: ; Win a toggles autocorrect on/off 
Suspend
ToolTip,% a_isSuspended?"Auto Off":"Auto On",  1790, 1520 
Return
That works from WITHIN my Autocorrect script, but only when I'm toggling it's state...

But I'm trying to find a way to ascertain whether the Autocorrect script is suspended using a DIFFERENT script (my main GUI script), without toggling the Autocorrect script. Specifically, my main GUI script is ALWAYS active, and I'd like to put a hotkey in that main GUI script to tell me whether or not the Autocorrect script is active or suspended. That way, I won't accidentally type a whole paragraph when I don't mean to use Autocorrect, and I won't type a bunch of stuff expecting Autocorrect to kick in if it's not active.

I've tried many different ways that people have given in the past, but none of them are working (E.g. https://stackoverflow.com/questions/14492650/check-if-script-is-suspended-in-autohotkey, https://www.autohotkey.com/board/topic/57245-how-can-i-find-if-other-script-is-pausedsuspended-4-pausing/, viewtopic.php?style=1&t=108887, https://www.autohotkey.com/board/topic/86757-how-to-check-if-another-script-is-currently-running/).

Any help greatly appreciated!

Rohwedder
Posts: 7656
Joined: 04 Jun 2014, 08:33
Location: Germany

Re: How Can I Have a Script Detect If a SECOND Script Is Suspended

Post by Rohwedder » 27 Mar 2024, 04:49

Hallo,
Do not let the Autocorrect script suspend itself, but let it suspend on/off with your main GUI script.
see https://www.autohotkey.com/docs/v1/lib/Suspend.htm#PostMessage
#2: Sends a Suspend command to another script.
Then the main GUI script knows what is going on.

AlFlo
Posts: 345
Joined: 29 Nov 2021, 21:46

Re: How Can I Have a Script Detect If a SECOND Script Is Suspended

Post by AlFlo » 27 Mar 2024, 13:46

Thank you, Rohwedder. I did have that working at one point, but it stopped working a couple of months ago.

My best guess is I accidentally changed some of the code.

Post Reply

Return to “Ask for Help (v1)”