Page 1 of 1
Hotkey script able to disable another script.
Posted: 01 Feb 2023, 23:21
by SebKat
Currently i use 2 separate scripts to make "F" and "SHIFT" keys work as Toggle keys:
Code: Select all
*f::
if GetKeyState("f")
Send {Blind}{f Up}
else
Send {Blind}{f Down}
return
F1::Suspend, Toggle
F3::ExitApp
Code: Select all
*LShift::
if GetKeyState("LShift")
Send {Blind}{LShift Up}
else
Send {Blind}{LShift Down}
return
F2::Suspend, Toggle
F4::ExitApp
My goal is to merge both scripts into ONE script and as the title states to be able to disable one key toggled when the other key toggle activates, in other words: if TOGGLE SHIFT -> ON when I press F to TOGGLE F -> SHIFT ON goes OFF.
I'm quite new to AHK and can't seem to find the correct way to make it work, any help is greatly appreciated.
Re: Hotkey script able to disable another script.
Posted: 02 Feb 2023, 02:34
by Rohwedder
Hallo,
perhaps ??:
Code: Select all
HF := HLShift := True
Return
*f::
Hotkey, *LShift, Off ;Switches Hotkey *LShift off
HLShift := False
if GetKeyState("f")
Send {Blind}{f Up}
else
Send {Blind}{f Down}
return
F1::Hotkey, *f,% (HF:=!HF)?"On":"Off" ;Toggles Hotkey *f
F3::ExitApp
*LShift::
Hotkey, *f, Off ;Switches Hotkey *f off
HF := False
if GetKeyState("LShift")
Send {Blind}{LShift Up}
else
Send {Blind}{LShift Down}
return
F2::Hotkey, *LShift,% (HLShift:=!HLShift)?"On":"Off" ;Toggles Hotkey *LShift
F4::ExitApp
Re: Hotkey script able to disable another script.
Posted: 03 Feb 2023, 00:54
by SebKat
Rohwedder wrote: ↑02 Feb 2023, 02:34
Hallo,
perhaps ??:
Code: Select all
HF := HLShift := True
Return
*f::
Hotkey, *LShift, Off ;Switches Hotkey *LShift off
HLShift := False
if GetKeyState("f")
Send {Blind}{f Up}
else
Send {Blind}{f Down}
return
F1::Hotkey, *f,% (HF:=!HF)?"On":"Off" ;Toggles Hotkey *f
F3::ExitApp
*LShift::
Hotkey, *f, Off ;Switches Hotkey *f off
HF := False
if GetKeyState("LShift")
Send {Blind}{LShift Up}
else
Send {Blind}{LShift Down}
return
F2::Hotkey, *LShift,% (HLShift:=!HLShift)?"On":"Off" ;Toggles Hotkey *LShift
F4::ExitApp
Edit: I re-tried the script and it actually does work but my goal was another, let me explain: i need to make one hotkey cancel the other hotkey (or at least let the other ficical key up. Eg: [F: ON --> SHIFT: OFF / SHIFT: ON --> F: OFF) so that both hotkeys are not toggled ON at the same time when i use one then the other.
Re: Hotkey script able to disable another script.
Posted: 03 Feb 2023, 01:55
by SebKat
I've managed to find how to do it simple added the State Up o the hotkey as an extra command and now it work as i wanted, thanks for the help!