Jump to content

Notify Or Do Something When Mouse Was Moved?


Recommended Posts

Global $XronikoOrio=4000
Global $x,$Y,$FoundMovement=0,$Terminate
GUICreate ( @ScriptName )

Global $Tote=TimerInit()

$MouseInfo=GUIGetCursorInfo()
$X=$MouseInfo[0]
$Y=$MouseInfo[1]
Do
    Sleep(50)
    $MouseInfo=GUIGetCursorInfo()
    Select
    case $FoundMovement=1
         $Tote=TimerInit(); Midenise Xronometrith
         MsgBox(0,"","Mouse moved")
         $FoundMovement=0
    case $MouseInfo[2]=1 or $MouseInfo[3]=1;Mouse Click
         $FoundMovement=1
    ;MsgBox(0,"","Mouse Click")
    case $X<>$MouseInfo[0] or $Y<>$MouseInfo[1];Mouse Movement
          $FoundMovement=1
          $X=$MouseInfo[0]
          $Y=$MouseInfo[1]
    case TimerDiff($Tote)>$XronikoOrio;Mouse not moved for too long!
             MsgBox(0,"","Mouse not moved last "&$XronikoOrio/1000&" secs!")
             $Tote=TimerInit()
    EndSelect
Until $Terminate
Exit

Edited by Amen
Link to comment
Share on other sites

  • Moderators

Along the same lines as Val:

Global $i_Saved_MPos = MouseGetPos()
While 1
    If _TrackMousePos(MouseGetPos()) Then; If Mouse Movement = True Then Do something
        Beep(1000, 500); Replace Beep() function with whatever you want
    EndIf
    Sleep(10)
WEnd

Func _TrackMousePos($i_Current_MPos)
    If $i_Current_MPos[0] <> $i_Saved_MPos[0] Or $i_Current_MPos[1] <> $i_Saved_MPos[1] Then
        $i_Saved_MPos[0] = $i_Current_MPos[0]
        $i_Saved_MPos[1] = $i_Current_MPos[1]
        Return 1
    EndIf
EndFunc
Except it's a function, and you can input it where ever.

Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer.

Link to comment
Share on other sites

Along the same lines as Val:

Global $i_Saved_MPos = MouseGetPos()
While 1
    If _TrackMousePos(MouseGetPos()) Then; If Mouse Movement = True Then Do something
        Beep(1000, 500); Replace Beep() function with whatever you want
    EndIf
    Sleep(10)
WEnd

Func _TrackMousePos($i_Current_MPos)
    If $i_Current_MPos[0] <> $i_Saved_MPos[0] Or $i_Current_MPos[1] <> $i_Saved_MPos[1] Then
        $i_Saved_MPos[0] = $i_Current_MPos[0]
        $i_Saved_MPos[1] = $i_Current_MPos[1]
        Return 1
    EndIf
EndFunc
Except it's a function, and you can input it where ever.
hey, thats cool smoke_n, I remember one script where it would do the same thing beap but the pitch would go higher or lower depending on possition of mouse, i forgot where i saw it :) Edited by slightly_abnormal
Link to comment
Share on other sites

lol! that's not it but that is cool!

here it found it with vaulaters searcher thingie

#include <misc.au3>
#NoTrayIcon
$P=1
While 1
    if (_IsPressed ("01") and _IsPressed ("02") and _IsPressed ("04")) or $P Then;to exit script you have to hold the buttons half a second
        Sleep (500)
        if _IsPressed ("01") or _IsPressed ("02") Then $P=0;if left/rigth mousebutton is klicked start beepthing
        if _IsPressed ("01") and _IsPressed ("02") and _IsPressed ("04") Then Exit;if left+right+third mousebutton is klicked exit script
    Else
        $Mouse = MouseGetPos()
        $Frequenz =($Mouse[0]/18+10)*($Mouse[1]/18+10);different sounds for mouse coords
        if _IsPressed ("01") then $Frequenz +=100
        if _IsPressed ("02") then $Frequenz +=200;higher sound if left/right mousebutton clicked
        Beep($Frequenz, 50)
    Endif
WEnd
Edited by slightly_abnormal
Link to comment
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
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...