Page 1 of 1

Simple Left and Right

Posted: 31 Mar 2018, 15:57
by Guest
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,

Re: Simple Left and Right

Posted: 31 Mar 2018, 16:21
by Prof1919
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.

Re: Simple Left and Right  Topic is solved

Posted: 31 Mar 2018, 21:25
by donovv

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}
	
	}

Re: Simple Left and Right

Posted: 01 Apr 2018, 09:26
by Prof1919
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.

Re: Simple Left and Right

Posted: 01 Apr 2018, 17:59
by donovv
Did you press f1 to run it

Re: Simple Left and Right

Posted: 01 Apr 2018, 19:03
by Prof1919
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.

Re: Simple Left and Right

Posted: 01 Apr 2018, 22:39
by donovv
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

Re: Simple Left and Right

Posted: 02 Apr 2018, 10:58
by Prof1919
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,

Re: Simple Left and Right

Posted: 02 Apr 2018, 20:37
by neverlevel
I would just delete the 4 and add f12::pause as the last line..loop forever....untill I pause it..

Re: Simple Left and Right

Posted: 21 Mar 2019, 21:52
by Prof1919
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.