Noob help please

Get help with using AutoHotkey and its commands and hotkeys
snakemetal
Posts: 3
Joined: 26 Aug 2016, 14:51

Noob help please

26 Aug 2016, 15:53

Hi
Ive spent all night reading the tutorials and trying to modify other peoples scripts with little success

All im looking for is a simple script that:

When i press a key it auto presses that key a couple of times a second (it doesn't want to be blazing fast) until i press the key again

So if i press p then it starts looping ppppp until i press p again like a on/off toggle

very simple but cant figure it out

Thanks
Helgef
Posts: 4458
Joined: 17 Jul 2016, 01:02
Contact:

Re: Noob help please

26 Aug 2016, 16:00

I guess sometimes you can't see the forest beacuse of all the trees. Here you go:

Code: Select all

stop:=1
$p::
	stop:=0
	Loop
	{
		Send,p
		Sleep,100 ; Modify the pppapupspppppppppuse <- tested :) 1000 ms = 1s.
	} until stop
return
#if !stop
p::
	stop:=1
return
snakemetal
Posts: 3
Joined: 26 Aug 2016, 14:51

Re: Noob help please

26 Aug 2016, 16:10

Many thanks
Though i cant get it to stop?
Helgef
Posts: 4458
Joined: 17 Jul 2016, 01:02
Contact:

Re: Noob help please

26 Aug 2016, 16:17

snakemetal wrote:Many thanks
Though i cant get it to stop?
I can if I prpeppsppppppppppppppppppppss pppppp twice?

Edit: Did you copppypppppppp the whole scripppppt or just down to (turning it off) p:: ?
snakemetal
Posts: 3
Joined: 26 Aug 2016, 14:51

Re: Noob help please

26 Aug 2016, 16:20

Perfect thanks
when i copied the script i hadn't scrolled down so only got what you see in the window lol
when i copied the whole script it worked
thanks again
Helgef
Posts: 4458
Joined: 17 Jul 2016, 01:02
Contact:

Re: Noob help please

26 Aug 2016, 16:24

Good, you can use [Select all] in the code boxes. Welcome and good luck.
foxhunter
Posts: 70
Joined: 04 Aug 2016, 04:27

Re: Noob help please

26 Aug 2016, 16:34

Great code helgef. I just updated it, as when the p key was short pressed (<1sec), it doesn't turn off. With UP it seems to do correct.

Code: Select all

stop:=1

$p::
	stop:=0
	Loop
	{
		Send,p
		Sleep,100 ; Modify the pppapupspppppppppuse <- tested :) 1000 ms = 1s.
	} until stop
return

#if !stop
p UP::
	stop:=1
return
Helgef
Posts: 4458
Joined: 17 Jul 2016, 01:02
Contact:

Re: Noob help please

26 Aug 2016, 16:47

I think the author wanted a script that sends until p is pressed again, not while its being held down, anyways, your modification is a good way to make send while hold.
foxhunter
Posts: 70
Joined: 04 Aug 2016, 04:27

Re: Noob help please

26 Aug 2016, 17:06

Oh man, my mistake

Return to “Ask For Help”

Who is online

Users browsing this forum: AHKStudent, aifritz, Bing [Bot], Jugi and 41 guests