kyler Posted December 19, 2006 Share Posted December 19, 2006 Hey, I was just wondering, is there a way to detect triple clicks with autoit and then have autoit do something? I know how to use is presses and detect mouse clicks but i have no idea how to detect the timing between them. If it was possible for somebody to make something that could detect this or point me to where somebody has already done this, i would be very thankful. Thanks in advance. Link to comment Share on other sites More sharing options...
littleclown Posted December 19, 2006 Share Posted December 19, 2006 (edited) I'm not sure is this works for you: While 1 $begin = TimerInit() $i=0 while $i<3 If _IsPressed("01") Then Do Until not _IsPressed("01") $i=$i+1 ;MsgBox(0,0,$i) EndIf WEnd $dif = TimerDiff($begin) if $dif<3000 Then MsgBox(0,"Test","Triple left click detected!") EndIf WEnd EDIT: Oh its not work well, and I know why. The script counts 3 clicks and if they are in 3 seconds do something. For every 3 clicks the script reset itself. But when you use your PC you clicks many times and when you wont to activate something with 3 fast clicks these click may be 44, 45, 46 for the program for example - the 44 click reset counter and other two clicks will not be recognized as triple click . I will think about this problem Edited December 19, 2006 by littleclown Link to comment Share on other sites More sharing options...
kyler Posted December 19, 2006 Author Share Posted December 19, 2006 thanks a lot littleclown, i took your example and i believe i've solved the problem you had. this is my script now and i'm using it to change songs in itunes with my mouse. expandcollapse popup#include <Misc.au3> While 1 $begin1 = TimerInit() $begin2 = TimerInit() $i=0 $j=0 while $i<3 And $j<3 If _IsPressed("01") Then If TimerDiff($begin1) > 500 Or $i = 0 Then $begin1 = TimerInit() $i = 0 EndIf Do Until not _IsPressed("01") $i=$i+1 ;MsgBox(0,0,$i) EndIf If _IsPressed("02") Then If TimerDiff($begin2) > 500 Or $j = 0 Then $begin2 = TimerInit() $j = 0 EndIf Do Until not _IsPressed("02") $j=$j+1 ;MsgBox(0,0,$j) EndIf sleep(10) WEnd $dif1 = TimerDiff($begin1) if $dif1<500 Then If $i = 3 Then next_song() EndIf $dif2 = TimerDiff($begin2) if $dif2<500 Then If $j = 3 Then prev_song() EndIf WEnd Func next_song() ;MsgBox(0,"","") If WinGetTitle("iTunes") = 0 Then Run("C:\Program Files\iTunes\iTunes.exe") If WinGetTitle("iTunes") = 0 Then Run("C:\Program Files\iTunes\iTunes.exe") WinActivate("iTunes") Send("{MEDIA_NEXT}") WinSetState("iTunes","",@SW_MINIMIZE) EndFunc Func prev_song() ;MsgBox(0,"","") $active = WinGetTitle("") WinActivate("iTunes") Send("{MEDIA_PREV}") WinSetState("iTunes","",@SW_MINIMIZE) EndFunc nice way to turn an 8-button mouse into a 10-button mouse lol. Link to comment Share on other sites More sharing options...
littleclown Posted December 20, 2006 Share Posted December 20, 2006 Yes, works fine Link to comment Share on other sites More sharing options...
Thatsgreat2345 Posted December 20, 2006 Share Posted December 20, 2006 U know Itunes has a com set up and if you check the example scripts u can see that it could be alot easier Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now