Simple Left and Right Topic is solved

Ask gaming related questions (AHK v1.1 and older)
Guest

Simple Left and Right

31 Mar 2018, 15:57

Hello All, I'm quite new to this. I'm quite the noob at this, especially the coding. Heck, it took me a small just to install this and I found myself attempting to figure out the help section thinking it was the actual application !

Anyway, my use is somewhat simple but I can't seem to figure it out. I just the "Left" an "Right" keys to be pressed every 2.5 seconds. So "Left" for 2.5 secs, then "Right" for 2.5 secs and so on. What would the coding for this be ? The overall duration for this, I can manipulate to my liking.

Help !

Thanks,
Prof1919
Posts: 5
Joined: 31 Mar 2018, 15:50

Re: Simple Left and Right

31 Mar 2018, 16:21

This was submitted by me. Apologies for the grammatical mistakes. I just want left for 2.5 seconds, then right for 2.5 seconds and for it to be repeated in this manner for XX amount of cycles.
donovv
Posts: 108
Joined: 15 Apr 2017, 21:06

Re: Simple Left and Right  Topic is solved

31 Mar 2018, 21:25

Code: Select all

f1::
	loop, 4; number of iterations to run
	{
		send {left down}
		sleep 2500
		send {left up}
		send {right down}
		sleep 2500
		send {right up}
	
	}
Prof1919
Posts: 5
Joined: 31 Mar 2018, 15:50

Re: Simple Left and Right

01 Apr 2018, 09:26

Thanks Mate,

For some reason, the script just doesn't seem to run. I tested this out on Windows Explorer. I left it on a window, then ran it thinking it will just go left and right between the files and nothing.
donovv
Posts: 108
Joined: 15 Apr 2017, 21:06

Re: Simple Left and Right

01 Apr 2018, 17:59

Did you press f1 to run it
Prof1919
Posts: 5
Joined: 31 Mar 2018, 15:50

Re: Simple Left and Right

01 Apr 2018, 19:03

donovv wrote:Did you press f1 to run it
Yes. I had to change it to F12 because the F1 did something in the application I wanted to use it for, but this also didn't work.

Even when I double click the script, it says "An older instance of this script is already running. Replace it with this instance?"

In both the application and in Windows Explorer, it doesn't seem to work. I only used it in explorer to see if it navigates back and forth through files.
donovv
Posts: 108
Joined: 15 Apr 2017, 21:06

Re: Simple Left and Right

01 Apr 2018, 22:39

sorry i forgot {key down} doesnt activate key repeat try this

Code: Select all

f1::
loop 4 {
	loop 50
	{
	send {left down}
	sleep 50
	}
	send {left up}
	loop 50
	{
	send {right down}
	sleep 50
	}
	send {right up}
}
return
Prof1919
Posts: 5
Joined: 31 Mar 2018, 15:50

Re: Simple Left and Right

02 Apr 2018, 10:58

Thank You Sir !!! It works !

I assume the "loop 4" controls how long this script runs for ? Am I correctly surmising that the sleep command controls the duration of how long a button is engaged for ?

Many Thanks for this,
neverlevel
Posts: 60
Joined: 13 Apr 2016, 22:02

Re: Simple Left and Right

02 Apr 2018, 20:37

I would just delete the 4 and add f12::pause as the last line..loop forever....untill I pause it..
Prof1919
Posts: 5
Joined: 31 Mar 2018, 15:50

Re: Simple Left and Right

21 Mar 2019, 21:52

How would I go about modifying this code so I pause it. I've attempted to incorporate code from the last post to no avail. As of now, I start it with "f" and wait till it loops.

As in, pressing "f" once starts an endless loop, and the 2nd press pauses it.

Return to “Gaming Help (v1)”

Who is online

Users browsing this forum: No registered users and 35 guests