| View previous topic :: View next topic |
| Author |
Message |
nvus
Joined: 02 Aug 2007 Posts: 29
|
Posted: Mon Jul 21, 2008 4:18 pm Post subject: holding a key down? |
|
|
i lost my script somewhere but i had it so that it remapped one of my mousebuttons to F12 and when i held down that mousebutton, it would spam F12 at a certain interval. when i let go of the mousebutton, it would stop
anyone have any ideas? |
|
| Back to top |
|
 |
HugoV
Joined: 27 May 2007 Posts: 650
|
|
| Back to top |
|
 |
Guest
|
Posted: Mon Jul 21, 2008 4:26 pm Post subject: Re: holding a key down? |
|
|
read my post? i did search and i did look at that topic already... its not what i want. |
|
| Back to top |
|
 |
Crackpot Guest
|
|
| Back to top |
|
 |
Guest
|
Posted: Mon Jul 21, 2008 4:59 pm Post subject: |
|
|
thanks, but theres still something wrong... this seems to do a double spam sometimes which doesnt allow me to hit other keys... the script i had was similar to this but there wasnt a loop... is was like
xbutton1::
{
GetKeyState, state, Lbutton, P
if state=D
{
Sendinput {F12}
Sleep 200
}
}
return |
|
| Back to top |
|
 |
nvus
Joined: 02 Aug 2007 Posts: 29
|
Posted: Mon Jul 21, 2008 5:04 pm Post subject: |
|
|
xbutton1::
GetKeyState, state, xbutton1, P
if state=D
{
Sendinput {F12}
Sleep 200
}
this is what i have so far but it doesnt spam F12 at an interval of 200ms. it only clicks F12 once |
|
| Back to top |
|
 |
Crackpot Guest
|
Posted: Mon Jul 21, 2008 5:05 pm Post subject: |
|
|
| Double spam is probably because of the low Sleep time, the script still has the mouse held down when it starts at the top, increase the Sleep a bit and mod it. It was just a rough version anyway. |
|
| Back to top |
|
 |
nvus
Joined: 02 Aug 2007 Posts: 29
|
Posted: Mon Jul 21, 2008 5:07 pm Post subject: |
|
|
| Crackpot wrote: | | Double spam is probably because of the low Sleep time, the script still has the mouse held down when it starts at the top, increase the Sleep a bit and mod it. It was just a rough version anyway. |
can you modify it so that it only spams if im holding the key down? if i release the key then it stops spamming?
and the double spam still happens when i increased the sleep to 200.. i used Sleep 200 on my old script and it didnt do that
the script i had wasnt a loop |
|
| Back to top |
|
 |
Crackpot Guest
|
Posted: Mon Jul 21, 2008 5:36 pm Post subject: |
|
|
| Code: | LButton::
Loop
{
GetKeyState, state, Lbutton, P
if state=U
{
return
}
{
Send {F12}
Sleep 500
}
}
return
|
Change the number after sleep to increase/decrease the speed. I'm afraid if there's a way to do it without a loop then I don't know it. Easiest way is with the loop. I tested this one and it doesn't double click. Like I said, the double spam was because the sleep timer was too low. |
|
| Back to top |
|
 |
nvus
Joined: 02 Aug 2007 Posts: 29
|
Posted: Mon Jul 21, 2008 5:51 pm Post subject: |
|
|
| Crackpot wrote: | | Code: | LButton::
Loop
{
GetKeyState, state, Lbutton, P
if state=U
{
return
}
{
Send {F12}
Sleep 500
}
}
return
|
Change the number after sleep to increase/decrease the speed. I'm afraid if there's a way to do it without a loop then I don't know it. Easiest way is with the loop. I tested this one and it doesn't double click. Like I said, the double spam was because the sleep timer was too low. |
ok this works but for some reason i cant hold the button down and click other buttons at the same time... |
|
| Back to top |
|
 |
Crackpot
Joined: 21 Jul 2008 Posts: 5
|
Posted: Mon Jul 21, 2008 5:58 pm Post subject: |
|
|
| Just change the Send {F12} to SendInput {F12}. That should solve the problem. |
|
| Back to top |
|
 |
nvus
Joined: 02 Aug 2007 Posts: 29
|
Posted: Mon Jul 21, 2008 6:17 pm Post subject: |
|
|
| Crackpot wrote: | | Just change the Send {F12} to SendInput {F12}. That should solve the problem. |
does the same thing... i wish i had saved my script  |
|
| Back to top |
|
 |
Crackpot
Joined: 21 Jul 2008 Posts: 5
|
Posted: Mon Jul 21, 2008 6:47 pm Post subject: |
|
|
| When I tested it I was alt tabbing and typing in notepad with the Left mouse button held down. |
|
| Back to top |
|
 |
nvus
Joined: 02 Aug 2007 Posts: 29
|
Posted: Mon Jul 21, 2008 6:48 pm Post subject: |
|
|
| Crackpot wrote: | | When I tested it I was alt tabbing and typing in notepad with the Left mouse button held down. |
i was testing it with the game i play and i was holding onto the spam button and hold control and F1 at the same time.....is there a way to retrieve deleted files? i deleted the script today >.< |
|
| Back to top |
|
 |
[VxE]
Joined: 07 Oct 2006 Posts: 1496
|
Posted: Mon Jul 21, 2008 6:56 pm Post subject: |
|
|
| Code: | *XButton1::
If !GetKeyState("XButton1","p")
return
SendInput, {blind}{F12}
SetTimer, *XButton1, -500
return | ....?.... _________________ My Home Thread
More Common Answers: [1]. It's in the FAQ [2]. Ternary ( a ? b : c ) guide [3]. Post code inside [code][/code] tags ! |
|
| Back to top |
|
 |
|