Just wanted to share the IDEA since I think time-delayed actions (eg. holding down a key for a certain period of time) could be very useful.
LButton::
if (A_Cursor = "Unknown") [color=#008000];eg. mouse over hyperlink[/color]
{
now_1 := A_TickCount [color=#008000];initial time[/color]
loop,
{
now_2 := A_TickCount [color=#008000];current time[/color]
elapsed_time := now_2 - now_1 [color=#008000];elapsed time since Lbutton held down[/color]
GetKeyState, state, Lbutton, P
if (state = "U" and elapsed_time < 500)
{
Click [color=#008000];retain native function if released under 500 ms[/color]
break
}
else if (state = "D" and elapsed_time > 500)
{
gosub Label1 [color=#008000];if held down longer than 500 ms... open link in new tab[/color]
break
}
}
}
else
gosub Label2
return
Label1:
Send, {ctrl down}
Click
Send, {ctrl up}
return
Label2:
Click Down
KeyWait, Lbutton
Click Up
return




