Hello, gentlemen!
I would like to help with the following: I need to create a loop that when I press the F1 key, it is alternating between F8, F7, F8, F6 and restart, but I need to press it again to stop where it is. Example: Press F1. It will loop the F8, F7, F8, F6, F8, F7 and if I press the F1 again it will stop at that time and not finish the sequence. Would it be possible? detail that should have a time of 1 second between each key.
Thanks a lot for the help.
Sorry for the translator's english
Help with Variation Loop Topic is solved
-
- Posts: 5
- Joined: 03 Apr 2018, 11:54
- Contact:
Re: Help with Variation Loop Topic is solved
Hallo,
try:
try:
Code: Select all
Keys = {F8},{F7},{F8},{F6}
Keys := StrSplit(Keys,",")
Return
F1:: ;Send Keys On/Off with key F1
If F4Active:=!F4Active
SetTimer SendKeys, 1000 ;1000 ms delay between keys
Else
SetTimer SendKeys, Off
Return
SendKeys:
Counter := Mod(0 Counter,Keys.MaxIndex())+1
Send, % Keys[Counter]
Return
-
- Posts: 5
- Joined: 03 Apr 2018, 11:54
- Contact:
Re: Help with Variation Loop
Hi, thanks for the feedback, I took the test here and it did not work, do you have any other ideas?
Thanks for help!
Thanks for help!
Rohwedder wrote:Hallo,
try:Code: Select all
Keys = {F8},{F7},{F8},{F6} Keys := StrSplit(Keys,",") Return F1:: ;Send Keys On/Off with key F1 If F4Active:=!F4Active SetTimer SendKeys, 1000 ;1000 ms delay between keys Else SetTimer SendKeys, Off Return SendKeys: Counter := Mod(0 Counter,Keys.MaxIndex())+1 Send, % Keys[Counter] Return
Re: Help with Variation Loop
Example:
HTH
Code: Select all
#NoEnv
F1::
SetTimer SendKeys, % (t:=!t) ? 1000 : "Off"
Counter := toggle := 0
Return
SendKeys:
Send, % Mod(++Counter,2) ? "{F8}" : (toggle:=!toggle) ? "{F7}" : "{F6}"
Return
-
- Posts: 5
- Joined: 03 Apr 2018, 11:54
- Contact:
Re: Help with Variation Loop
I re-did the test and it worked!
SORRY!! AND THANK YOU SO MUCH!!
SORRY!! AND THANK YOU SO MUCH!!
guilhermevs91 wrote:Hi, thanks for the feedback, I took the test here and it did not work, do you have any other ideas?
Thanks for help!
Rohwedder wrote:Hallo,
try:Code: Select all
Keys = {F8},{F7},{F8},{F6} Keys := StrSplit(Keys,",") Return F1:: ;Send Keys On/Off with key F1 If F4Active:=!F4Active SetTimer SendKeys, 1000 ;1000 ms delay between keys Else SetTimer SendKeys, Off Return SendKeys: Counter := Mod(0 Counter,Keys.MaxIndex())+1 Send, % Keys[Counter] Return
Re: Help with Variation Loop
Hi,
I'm glad you got it working.
I came up to a code for more general situations, it's something like this:
EDIT:
I thought it was doing an extra line within the while-loop code after toggled off, but I could not replicate.
So it's good.
Regards
I'm glad you got it working.
I came up to a code for more general situations, it's something like this:
Code: Select all
F4::
Toggle:= !toggle
If Toggle {
While Toggle {
; code
}
Return
}
If !Toggle
; code
Return
I thought it was doing an extra line within the while-loop code after toggled off, but I could not replicate.
So it's good.
Regards
Who is online
Users browsing this forum: hugojans and 98 guests