Jump to content
Sign in to follow this  
Dark_Raver

Mouse detecting stuff

Recommended Posts

Dark_Raver

so im trying to make something (its a secret :o..ok its still forming in my head :))

but it involves detecting mouse clicks (left, right and scroller) and the distance traveled

i have completely no clue on the click detection :(

i tried the mouse distance and i could do it for like 25%

it has to automaticly update on a gui (no problem)

but the way i did it is fairly complicated (it uses 5 vars to detect the distance (calculates but anyway)) but it resets to zero every time :(

so any ideas? oh it has to be able to save and reloaded from a ini file or so but thats just a iniwrite in the end or so i think :P

btw, i jsut saw i posted it in the wrong forum :) can anyone move this please? :)

Edited by Dark_Raver

Share this post


Link to post
Share on other sites
martin

so im trying to make something (its a secret :o..ok its still forming in my head :))

but it involves detecting mouse clicks (left, right and scroller) and the distance traveled

i have completely no clue on the click detection :(

i tried the mouse distance and i could do it for like 25%

it has to automaticly update on a gui (no problem)

but the way i did it is fairly complicated (it uses 5 vars to detect the distance (calculates but anyway)) but it resets to zero every time :(

so any ideas? oh it has to be able to save and reloaded from a ini file or so but thats just a iniwrite in the end or so i think :P

btw, i jsut saw i posted it in the wrong forum :) can anyone move this please? :)

measure distance maybe like this

HotKeySet("{F7}","startmeas")
HotKeySet("{F8}","stopmeas")
HotKeySet("{F9}","exitnow")
global $lastpos,$dist=0
while 1
    
    sleep (40)
WEnd
Func exitnow()
    Exit
EndFunc

func startmeas()
    
    $lastpos = mousegetpos()
    adlibenable("measure",100)
EndFunc

Func stopmeas()
    AdlibDisable()
    Tooltip("")
EndFunc

func measure()
Local $mp = MouseGetPos()

Local $lastdist = (($mp[0] - $lastpos[0])^2 + ($mp[1] - $lastpos[1])^2)^0.5
$dist += $lastdist
$lastpos = $mp
tooltip(Int($dist),$mp[0],$mp[1]-20)
EndFunc

Serial port communications UDF Includes functions for binary transmission and reception.printing UDF Useful for graphs, forms, labels, reports etc.Add User Call Tips to SciTE for functions in UDFs not included with AutoIt and for your own scripts.Functions with parameters in OnEvent mode and for Hot Keys One function replaces GuiSetOnEvent, GuiCtrlSetOnEvent and HotKeySet.UDF IsConnected2 for notification of status of connected state of many urls or IPs, without slowing the script.

Share this post


Link to post
Share on other sites
Dark_Raver

sweet :) it works

never ised adlib, forgot it existed :)

i have modified it to my needs and it runs like a charm :)

but can you explain this perhaps?

(($mp[0] - $lastpos[0])^2 + ($mp[1] - $lastpos[1])^2)^0.5

now just need the mouse clikc detection and im on my way again ;D

Share this post


Link to post
Share on other sites
joseLB

measure distance maybe like this

Simple and works! Great job

Jose

Share this post


Link to post
Share on other sites

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this  

×