Quantcast
Channel: AutoIt v3 - General Help and Support
Viewing all articles
Browse latest Browse all 12506

compare mouse cursor position - code efficiency

$
0
0

is there a better way of writing this code?

i am interested in speed/efficiency more than readability

 

i want to get the cursor position at 2 different times, then compare them to see if it was moved beyond the threshold values

the code i have works fine, but i have a suspession there is a better way to write it so maybe it runs faster???

$XPixelThreshold = 10 $YPixelThreshold = 10 $a_mPos1 = MouseGetPos() ; wait on user to do stuff $a_mPos2 = MouseGetPos() ; check to see if cursor was moved at least the number of pixels as specified by threshold values If $a_mPos2[0] > $a_mPos1[0] + $XPixelThreshold Or $a_mPos2[0] < $a_mPos1[0] - $XPixelThreshold Or $a_mPos2[1] > $a_mPos1[1] + $YPixelThreshold Or $a_mPos2[1] < $a_mPos1[1] - $YPixelThreshold Then     ; stuff to do EndIf

Viewing all articles
Browse latest Browse all 12506

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>