I Need Help Making Multiple Clicks Mean Different Things
I Need Help Making Multiple Clicks Mean Different Things
I need a Script that will make it to where if i press XButton2 1 time it enters the number 1 If pressed 2 times it enters 2. 3 times enters 3 ect. i need it to do that up to 9 so if pressed 9 times it enters 9 New to scripting and just cant figure it out for the life of me PLEASE HELP!!!!!!!!!!!
- Masonjar13
- Posts: 1555
- Joined: 20 Jul 2014, 10:16
- Location: Не Россия
- Contact:
Re: I Need Help Making Multiple Clicks Mean Different Things
Ultimately depends on what kind of delay you want between each key press. For a double-click, you can use A_TimeSinceThisHotkey. If it's less than, say 100, you can perform a check for that and do something otherwise. For multiple keys, you'll need to keep a counter for each time it's pressed, then reset it every time it completes. You might also be able to make use of SetTimer, re setting the timer each time the hotkey is pressed.
- AlphaBravo
- Posts: 586
- Joined: 29 Sep 2013, 22:59
Re: I Need Help Making Multiple Clicks Mean Different Things
I posted something similar earlier today here
this worked for my using Lbutton , try it with xButton2 on your end
this worked for my using Lbutton , try it with xButton2 on your end
Code: Select all
DoubleClick_Time := DllCall("User32\GetDoubleClickTime")
Hotkey, % "$~Lbutton" , ClickHandler, on ; < replace Lbutton with xButton2
return
ClickHandler:
Accu .= SubStr(A_ThisHotkey, 0)
If (A_TimeSincePriorHotkey < DoubleClick_Time)
SetTimer, TheBigShebang, % -DoubleClick_Time
If (A_TimeSincePriorHotkey > DoubleClick_Time + 100)
Accu := SubStr(A_ThisHotkey, 0)
return
TheBigShebang:
If Accu
Send % StrLen(accu)
return
Re: I Need Help Making Multiple Clicks Mean Different Things
AlphaBravo It works but wont do the number 1 when clicked once anyway to fix?
- AlphaBravo
- Posts: 586
- Joined: 29 Sep 2013, 22:59
Re: I Need Help Making Multiple Clicks Mean Different Things
slight change:Brenyd wrote:AlphaBravo It works but wont do the number 1 when clicked once anyway to fix?
Code: Select all
DoubleClick_Time := DllCall("User32\GetDoubleClickTime")
Hotkey, % "$~Lbutton" , ClickHandler, on ; < replace Lbutton with xButton2
return
ClickHandler:
Accu .= SubStr(A_ThisHotkey, 0)
If (A_TimeSincePriorHotkey < DoubleClick_Time)
SetTimer, TheBigShebang, % -DoubleClick_Time
If (A_TimeSincePriorHotkey > DoubleClick_Time + 100)
{
Accu := SubStr(A_ThisHotkey, 0)
gosub TheBigShebang
}
return
TheBigShebang:
If Accu
Send % "{End}" StrLen(accu)
return
Re: I Need Help Making Multiple Clicks Mean Different Things
I know im being a pain in your ass but the problem with this script is that it does everything i need it too but in between each number are 1s so if i wanted to type 2 it'd be 112 3 would be 1113 idk if there is any more tweaking you can do to fix it but it would awesome if that is possibleAlphaBravo wrote:slight change:Brenyd wrote:AlphaBravo It works but wont do the number 1 when clicked once anyway to fix?Code: Select all
DoubleClick_Time := DllCall("User32\GetDoubleClickTime") Hotkey, % "$~Lbutton" , ClickHandler, on ; < replace Lbutton with xButton2 return ClickHandler: Accu .= SubStr(A_ThisHotkey, 0) If (A_TimeSincePriorHotkey < DoubleClick_Time) SetTimer, TheBigShebang, % -DoubleClick_Time If (A_TimeSincePriorHotkey > DoubleClick_Time + 100) { Accu := SubStr(A_ThisHotkey, 0) gosub TheBigShebang } return TheBigShebang: If Accu Send % "{End}" StrLen(accu) return
- AlphaBravo
- Posts: 586
- Joined: 29 Sep 2013, 22:59
Re: I Need Help Making Multiple Clicks Mean Different Things
no, it's my bad.
this seems to work now
Edited
this seems to work now
Code: Select all
DoubleClick_Time := DllCall("User32\GetDoubleClickTime")
Hotkey, LButton, ClickHandler, on
return
ClickHandler:
Accu .= "x"
SetTimer, TheBigShebang, % -DoubleClick_Time
If (A_TimeSincePriorHotkey > DoubleClick_Time+100)
Accu := "x"
return
TheBigShebang:
send % StrLen(accu)
return