Jump to content

Recommended Posts

Guest godzcpr
Posted

hey i was wonderin if ths possible in autoit, can you make the mouse do movements just inside a window? if so anyone help me out here? thx

Posted

hey i was wonderin if ths possible in autoit, can you make the mouse do movements just inside a window? if so anyone help me out here? thx

<{POST_SNAPBACK}>

Yep! This sample script will open Notepad, and move the mouse around inside its window. Press ESC to stop the script. Move the Notepad window to another location, resize the window, and run the script again. The mouse will stay within the window at the new location. Additional code is required if the window is moved after starting the script.

HotKeySet("{ESC}", "_Exit")

If Not WinExists("Untitled - Notepad") Then Run("Notepad")
Sleep(200)
WinActivate("Untitled - Notepad")
Local $iPos[4]
Opt("MouseCoordMode", 1)
; Left, Top, Width, Height
$iPos = WinGetPos("Untitled - Notepad")
$iMinX = $iPos[0]; Left
$iMinY = $iPos[1]; Top
$iMaxX = $iPos[2]; Width
$iMaxY = $iPos[3]; Height

; Move the mouse randomly within the Notepad window.
while 1
   MouseMove($iMinX + Random(0, $iMaxX, 1), $iMinY + Random(0, $iMaxY, 1), 10)
WEnd
exit

Func _Exit()
   Exit
EndFunc

Phillip

Posted (edited)

i think he ment he want to make the mouse move only in the window.

i did it 2-3 days ago but i can't remember which function i used :/

oh ya! i just remember:

u need larry's http://www.autoitscript.com/fileman/users/Larry/au3xtra.zip then look in info.au3 for MouseTrap

Edited by tamir

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
  • Recently Browsing   0 members

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