Reputation: 13
I am trying to make (Holding down the left button for 1s) to make it do a right click. Here's what i got:
LButton::
MouseClick, right, , , 1, 0, D
Sleep 0
MouseClick, right, , , 1, 0, U
return
How to change the "LButton" input into "Hold LButton for 1 second"?
Upvotes: 1
Views: 135
Reputation:
Here you go:
#Persistent
#SingleInstance Force
#NoEnv
SetBatchLines, -1
global timeDown = 0
SetTimer, checkLeftClick,25
checkLeftClick:
if( GetKeyState("LButton" , "P") )
{
timeDown += 25
}
else
{
timeDown = 0
}
if(timeDown > 1000)
{
MouseClick , left , , , , ,U
Click,Right
timeDown = 0
}
return
Upvotes: 0
Reputation: 7953
How about this...
LButton::
StartTime := A_TickCount ; Set the timer
KeyWait, LButton ; Wait for release of mousebutton
ElapsedTime := A_TickCount - StartTime ; Calculate elapsed time
if (ElapsedTime > 1000)
Click, Right ; when longer than 1000 ms
Click, Left ; when shorter than 1000 ms
return
The disadvantage is that you can't use the mouse for e.g. highlighting text anymore...
Upvotes: 1