Problem with suspending script with 2 function

Get help with using AutoHotkey (v1.1 and older) and its commands and hotkeys
Hajdes
Posts: 38
Joined: 30 Jul 2021, 17:29

Problem with suspending script with 2 function

01 Aug 2021, 10:03

Hello I have got problem with my script, when I start it and for the first run label "Dzialanie" it suspend script but not unsuspend it. So I must reload my script, but when for the first I start label "Zabezpieczenieczatu" (this label do it function so it work) and for the secound label "Dzialanie" it label isn't work. What is wrong with this code? :

Code: Select all

global czacik:=true

Hotkey, %DzialanieGuzik%, Dzialanie
Hotkey, %ZabezpieczenieczatuGuzik%, Zabezpieczenieczatu

Dzialanie:
if(czacik=true){
    Suspend 
    ToolTip % A_IsSuspended ? "Skrypt wyłączony z użycia" : "", 400, 0
}

Return
;```````````````````````````````````````````````````````````````````````````````````````````
Zabezpieczenieczatu:
~t::
    Suspend On
	czacik=false
    Loop
        if (GetKeyState("Enter", "P") || GetKeyState("Escape", "P"))
            break
    Suspend Off
	czacik=true
return
[Mod edit: [code][/code] tags added.]

I want that when the label "Zabezpieczenieczatu" is working that the label "Dzialanie" doesn't work, and vice versa when the label "Dzialanie" is working all script is suspended. Label "Dzialanie is a toggle, the same key set it on and off.
Rohwedder
Posts: 7630
Joined: 04 Jun 2014, 08:33
Location: Germany

Re: Problem with suspending script with 2 function

01 Aug 2021, 10:19

Hallo,
(untested), replace:

Code: Select all

czacik=true
to

Code: Select all

czacik:=true
and

Code: Select all

czacik=false
to

Code: Select all

czacik:=false
Hajdes
Posts: 38
Joined: 30 Jul 2021, 17:29

Re: Problem with suspending script with 2 function

01 Aug 2021, 10:31

Rohwedder wrote:
01 Aug 2021, 10:19
Hallo,
(untested), replace:

Code: Select all

czacik=true
to

Code: Select all

czacik:=true
and

Code: Select all

czacik=false
to

Code: Select all

czacik:=false

Code: Select all

Zabezpieczenieczatu:
~t::
    Suspend On
	czacik:=false ; I change here
    Loop
        if (GetKeyState("Enter", "P") || GetKeyState("Escape", "P"))
            break
    Suspend Off
	czacik:=true ; I change here
return
If you meant here it doesn't work but when for the first I start label "Zabezpieczenieczatu" (this label do it function so it work) and for the secound label "Dzialanie" it label is work, it suspend script but not unsuspend it

Return to “Ask for Help (v1)”

Who is online

Users browsing this forum: doodles333, wilkster and 320 guests