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

Mouse barrier script help.

$
0
0

I've been trying to get this script working which was written for me by somebody who i can no longer contact.

 

There are two issues i would like to change.

 

The first one i assume is easy, i want a hotkey to turn it on and off on the fly without closing the process.

 

And the second one is a bug where if you move your mouse along the X axis and run into the wall, the mouse will teleport to the opposite side. Which is causing me some problems.

AutoIt         
$enabled = True $cx = 1920/2; $cy = 1080/2; $r = 150; $pi = 3.14159265358979 While True    if $enabled Then       $pos = MouseGetPos();       $dist = Sqrt(($pos[0]-$cx)^2 + ($pos[1]-$cy)^2);       if $dist > $r Then          $angle = atan(($cx-$pos[0]) / ($cy-$pos[1]));                    $x = $r*Sin($angle);          $y = $r*Cos($angle);                    if $pos[1] >= $cy Then             $x = $cx + $x;             $y = $cy + $y;          Else             $x = $cx - $x;             $y = $cy - $y;          EndIf                    MouseMove ( $x, $y, 0 );          ToolTip($x&","&$y,900,5);       EndIf    Else       Sleep(1000)    EndIf WEnd

If anybody could give me a hand that would be fantastic.


Viewing all articles
Browse latest Browse all 12506

Trending Articles



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