Toggle monitor

Ask gaming related questions (AHK v1.1 and older)
H4rdkn0x
Posts: 7
Joined: 28 Aug 2021, 03:35

Toggle monitor

Post by H4rdkn0x » 19 Sep 2021, 07:51

Code: Select all

 #IfWinActive, xxx
Process,Priority,,A
#NoEnv
#KeyHistory 0
FN = F1
Del:: ;toggles between F1 and F2
IF FN = F1
    FN = F2
Else
    FN = F1
Return
WheelLeft:: Settimer, test, on
#InputLevel 1
test:
{
    Send, {F5}
    sleep, 50
    Send, {F6}
    sleep, 50
    Send, {%FN%}
    sleep, 500
    Send, {F4}
    sleep, 600
    Send, {%FN%}
    sleep, 500
    Send, {F4}
    sleep, 600
}
return
WheelRight::
reload 
Is it possible to show in gui with hotkey is now activated between F1 or F2? if so, what should the code look like? for example I wanna see this hotkey on:

Code: Select all

 Gui, show, h400 h200 

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

Re: Toggle monitor

Post by mikeyww » 19 Sep 2021, 08:47

Code: Select all

Gui, +AlwaysOnTop
Gui, Font, s10
Gui, Add, Text, vtext, % FN := "F1"
Gui, Show, w200 NoActivate, FN
#IfWinActive ahk_exe notepad.exe
Del::GuiControl,, text, % FN := "F" 3 - SubStr(FN, 0)
#IfWinActive
This also fixes the bug with your directive.

Or:

Code: Select all

Gui, +AlwaysOnTop
Gui, Font, s10
Gui, Add, Text, vtext, % "F" FN := 1
Gui, Show, w200 NoActivate, FN
#IfWinActive ahk_exe notepad.exe
Del::GuiControl,, text, % "F" FN := 3 - FN
#IfWinActive

H4rdkn0x
Posts: 7
Joined: 28 Aug 2021, 03:35

Re: Toggle monitor

Post by H4rdkn0x » 19 Sep 2021, 09:23

looks promising, but shows F1 constantly
Image

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

Re: Toggle monitor

Post by mikeyww » 19 Sep 2021, 09:48

Yeah, the hotkey works in Notepad, but you can remove that line (5) if needed. I assumed that you wanted to press Del to toggle the GUI display.

H4rdkn0x
Posts: 7
Joined: 28 Aug 2021, 03:35

Re: Toggle monitor

Post by H4rdkn0x » 19 Sep 2021, 10:26

50% succes, now it's change from F1 to F2 but works only once time. When i run my script WheelLeft:: and press Del it's change but if i stop my script by press WheelRight:: and start it again by press WheelLeft:: and again pess Del nothing happend

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

Re: Toggle monitor

Post by mikeyww » 19 Sep 2021, 13:53

1. See if my script by itself works first.
2. After #1, and you add your code, feel free to post your revision.

Post Reply

Return to “Gaming Help (v1)”