Suspend section
Posted: 24 Jan 2022, 09:32
Hi, I am trying to write a code but I cannot make it work properly.
Let's say I have 10 hotkeys in my code, I need the first 5 to work everytime (except when I suspend the entire script),
instead the last 5 hotkeys I want to work everytime (except obviously when I suspend the entire script), but I want to suspend them also if I press Ctrl+h.
So I thought I need to have a section that could be switched off by pressing a button and reactivated pressing again the same button.
I tried the following solution but is not working.
(My idea was to initiate a variable "State" and make it true when I start the .ahk, then if I press ^h I want to switch the state " if true→false or if false→true" and make the hotkeys active only when the State is true)
[Mod edit: [code][/code] tags added.]
If I need to post my code tell me, but it may be confusing., instead of working on a sample that is easy and where I could learn my self how to adapt the solution to my code.
Let's say I have 10 hotkeys in my code, I need the first 5 to work everytime (except when I suspend the entire script),
instead the last 5 hotkeys I want to work everytime (except obviously when I suspend the entire script), but I want to suspend them also if I press Ctrl+h.
So I thought I need to have a section that could be switched off by pressing a button and reactivated pressing again the same button.
I tried the following solution but is not working.
(My idea was to initiate a variable "State" and make it true when I start the .ahk, then if I press ^h I want to switch the state " if true→false or if false→true" and make the hotkeys active only when the State is true)
Code: Select all
VK31::Suspend ;Suspend all the script
;SECTION 1
State = true
^h::
If State = true
{
State = false
}
else
{
State = true
}
If Var = true
{
Hotkeys active
}
; SECTION 2 (must be always on except obviously when VK31 is pressed)
If I need to post my code tell me, but it may be confusing., instead of working on a sample that is easy and where I could learn my self how to adapt the solution to my code.