Hi, i'd be glad if someone could lend me some simple help on this. Sorry for asking this for the 1,000 time probably.
I have this script that's incomplete below, that took me awhile to create with help. Anyhow i just would want F3 to toggle through the modes.
Instead of separate binds like i had it before like( F3,F4,F5,F6) I would rather want F3 just to toggle through them all when i keep pressing it.
If anyone could help i'd surely appreciate it
loop
{
GetKeyState, state, F3
if state = D
{
SoundPlay, %A_ScriptDir%\win1.mp3
win1:=true
win2:=false
win3:=false
win4:=false
}
GetKeyState, state, F3
if state = D
{
SoundPlay, %A_ScriptDir%\win2.mp3
win2:=true
win1:=false
win3:=false
win4:=false
}
GetKeyState, state, F3
if state = D
{
SoundPlay, %A_ScriptDir%\win3.mp3
win3:=true
win1:=false
win2:=false
win4:=false
}
GetKeyState, state, F3
if state = D
{
SoundPlay, %A_ScriptDir%\win4.mp3
win4:=true
win1:=false
win2:=false
win3:=false
}
}
r::
;window 1
while win1==true && GetKeyState("r")
{
sleep 10
break
}
;window 2
while win2==true && GetKeyState("r")
{
sleep 10
break
}
;window 3
while win3==true && GetKeyState("r")
{
sleep 10
break
}
;window 4
while win4==true && GetKeyState("r")
{
sleep 10
break
}
How to make one key toggle through modes? Topic is solved
-
- Posts: 2
- Joined: 20 Feb 2019, 14:24
Re: How to make one key toggle through modes? Topic is solved
Hi,
You can use a simple counter + #if blocks for that
Cheers!
You can use a simple counter + #if blocks for that
Code: Select all
F3::
mode++ ; increment on each key press
if mode = 4 ; after pressing it the 4th time:
{
mode = 1 ; Set mode back to 1
}
return
#if mode = 1 ; first key press
F1:
MsgBox, hello from mode 1!
return
#if mode = 2 ; second key press
F1:
MsgBox, hello from mode 2!
return
#if mode = 3 ; third key press
F1:
MsgBox, hello from mode 3!
return
#if ; close #if block
Please use [code][/code] when posting code!
Keyboard: Logitech G PRO - Mouse: Logitech G502 LS - OS: Windows 10 Pro 64 Bit - AHK version: 1.1.33.09
Keyboard: Logitech G PRO - Mouse: Logitech G502 LS - OS: Windows 10 Pro 64 Bit - AHK version: 1.1.33.09
-
- Posts: 2
- Joined: 20 Feb 2019, 14:24
Re: How to make one key toggle through modes?
Thank you very much it works perfect.
Your a great person man thank you for helping me
Your a great person man thank you for helping me
Who is online
Users browsing this forum: Descolada, Google [Bot], Kobaltauge, Rohwedder and 175 guests