Need a double click script Topic is solved
Need a double click script
Hi.
I need a script that keeps double-clicking as long as I'm holding down the Mouse's forward AND backward buttons at the same time.
Can anyone please give me a script that does that?
I really need that and I couldn't put more time into making it, it kept not working the way I wanted, I gave up cause I'm really noob at ahk.
Thanks.
I need a script that keeps double-clicking as long as I'm holding down the Mouse's forward AND backward buttons at the same time.
Can anyone please give me a script that does that?
I really need that and I couldn't put more time into making it, it kept not working the way I wanted, I gave up cause I'm really noob at ahk.
Thanks.
Re: Need a double click script
Hallo,
perhaps?:
perhaps?:
Code: Select all
#Persistent
#InstallMouseHook
SetTimer, double_clicking, 200
double_clicking:
If GetKeyState("XButton1","P") And GetKeyState("XButton2","P")
Click 2
Return
Re: Need a double click script
I actually did mix up some pieces of code and made a script really similar to what you posted, and it works fine, BUT not everywhere, it's really weird and I didn't know how to fix it, I'll try to show it in a gif:Rohwedder wrote: ↑20 May 2024, 10:37Hallo,
perhaps?:Code: Select all
#Persistent #InstallMouseHook SetTimer, double_clicking, 200 double_clicking: If GetKeyState("XButton1","P") And GetKeyState("XButton2","P") Click 2 Return
As you can see it works fine in the text editor app, but not in the other app, it doesn't change the pages... There was also another app which this script couldn't work but I don't remember where it was...
Things I've tried but didn't work:
Increasing the SetTimers delay to 1000ms or decreasing it to 100ms or even 1ms.
Changing the "Click 2" to "ClicK".
Changing the "Click 2" to "Send {LButton}".
By not working, I mean it worked like shown in the gif... it worked in the text editor but not in that other PDF viewer app...
- Attachments
-
- DoubleClick.gif (945.9 KiB) Viewed 787 times
- CoffeeChaton
- Posts: 37
- Joined: 11 May 2024, 10:50
Re: Need a double click script
Try running the script with administrator rights?
Re: Need a double click script
Didn't work.
Re: Need a double click script
Maybe this the other app doesn't like that the XButton1+2 are pressed?
Try:
Try:
Code: Select all
#Persistent
#InstallMouseHook
SetTimer, double_clicking, 200
double_clicking:
If GetKeyState("XButton1","P") And GetKeyState("XButton2","P")
{
Send,% GetKeyState("XButton1")?"{Blind}{XButton1 Up}{XButton2 Up}":""
Click 2
}
Return
Re: Need a double click script
Yep, this one works in that PDF viewer app too. But I don't need any delay between the clicks, I want it to behave exactly like a physical double-click button on the mouse (Which my new mouse lacks and I thought it was not that needed but I was a bit wrong...), I tried setting the delay to 0ms and use Click 3 instead of Click 2, but it accumulates all the clicks when I hold it for a few seconds... and keeps clicking... which is kinda bad. This doesn't happen with a physical button, it stops when you stop holding it down...Rohwedder wrote: ↑21 May 2024, 00:21Maybe this the other app doesn't like that the XButton1+2 are pressed?
Try:Code: Select all
#Persistent #InstallMouseHook SetTimer, double_clicking, 200 double_clicking: If GetKeyState("XButton1","P") And GetKeyState("XButton2","P") { Send, {Blind}{XButton1 Up}{XButton2 Up} Click 2 } Return
Can you fix that? Thanks a lot.
Re: Need a double click script
I don't know the behavior of a physical double-click mouse button, but I assume it doesn't continuously send double-clicks when held down:
Try:
Try:
Code: Select all
#Persistent
#InstallMouseHook
#IF GetKeyState("XButton1","P")
*XButton2::Send, {Blind}{XButton1 Up}{LButton 2}
#IF GetKeyState("XButton2","P")
*XButton1::Send, {Blind}{XButton2 Up}{LButton 2}
#IF
Re: Need a double click script
Sorry, I think I was a bit unclear. The previous script works fine. I wanted it to work exactly like that. I want to hold both forward & backward keys and it should send clicks continuously... (Not necessarily double clicks, what I need is a way to click fast repeatedly...) The problem that I mentioned in my previous comment, was that when I wanted to increase the speed of clicks, I increased the number from 2 to 3, and I decreased the delay to 0ms. By the accumulation of clicks, I meant that if I hold down the forward & backward buttons for a few seconds (8~10 seconds) then I think because it sends a huge number of click commands, it doesn't stop clicking even when I release the forward & backward buttons and it keeps clicking until all the sent click commands get finished... That's the problem. I think I was really unclear in my previous comment since I didn't mention that it keeps clicking even after releasing the forward & backward buttons. I don't know if there's a way to fix that, the previous script works well enough right now with 2 clicks...Rohwedder wrote: ↑21 May 2024, 04:14I don't know the behavior of a physical double-click mouse button, but I assume it doesn't continuously send double-clicks when held down:
Try:Code: Select all
#Persistent #InstallMouseHook #IF GetKeyState("XButton1","P") *XButton2::Send, {Blind}{XButton1 Up}{LButton 2} #IF GetKeyState("XButton2","P") *XButton1::Send, {Blind}{XButton2 Up}{LButton 2} #IF
it stops clicking right after I release the forward & backward buttons...
But the problem that I described is a point of improvement if you wanted to make the script work correctly even with more number of clicks like 3 and above...
Re: Need a double click script Topic is solved
Then:
Code: Select all
#InstallMouseHook
#IF GetKeyState("XButton1","P")
*XButton2::
#IF GetKeyState("XButton2","P")
*XButton1::
#IF
Send, {Blind}{XButton1 Up}{XButton2 Up}
SetTimer, double_clicking, 200
double_clicking:
If GetKeyState("XButton1","P") And GetKeyState("XButton2","P")
Click 2
Else SetTimer, double_clicking, Off
Return
Re: Need a double click script
Yep, this one works better even with more mouse clicks. Thank you so much.Rohwedder wrote: ↑21 May 2024, 08:43Then:Code: Select all
#InstallMouseHook #IF GetKeyState("XButton1","P") *XButton2:: #IF GetKeyState("XButton2","P") *XButton1:: #IF Send, {Blind}{XButton1 Up}{XButton2 Up} SetTimer, double_clicking, 200 double_clicking: If GetKeyState("XButton1","P") And GetKeyState("XButton2","P") Click 2 Else SetTimer, double_clicking, Off Return