Jump to content

Mouse Movement and Click


s3xy
 Share

Recommended Posts

hi guys, this is my first time actually trying to use autoit, i tried it before but its a complete script already.

and this time i want to actually write one myself.

i just wanted to know how i can make autoit start a program and move to 1 specific location and be able to left click

in a certain time intervals.

Any directions of help will be welcome. i know i have to do some research myself, but seems to be none that i can find of. Thanks guys.

Link to comment
Share on other sites

Hi S3xy.

I believe the commands you are looking for is Run and MouseClick. More details on how to use these commands can be found from the following links.

http://www.autoitscript.com/wiki/Run

http://www.autoitscript.com/wiki/MouseClick

Hope this helps,

DMN

Link to comment
Share on other sites

check the help file it helps alot.

and heres one way:

$form1 = GUICreate("run notepad",200, 200, 500, 200)
$button = GUICtrlCreateButton("run notepad", 50, 50, 100, 50)
$button2 = GUICtrlCreateButton("click me to click the button above me", 20, 100, 180, 50)
GUISetState()

While 1
$msg=GUIGetMsg()
If $msg = -3 Then Exit
If $msg = $button Then notepad()
If $msg = $button2 Then click()
WEnd

Func click()
    MouseClick("left", 604, 302) ;;careful because if the gui moves it probly wont hit the button.
EndFunc

Func notepad()
    Run("notepad.exe")
EndFunc

[spoiler]My UDFs: Login UDF[/spoiler]

Link to comment
Share on other sites

instead of mouseclick you can use controlclick but it dosent move the mouse.

$form1 = GUICreate("run notepad",200, 200, 500, 200)
$button = GUICtrlCreateButton("run notepad", 50, 50, 100, 50)
$button2 = GUICtrlCreateButton("click me to click the button above me", 20, 100, 180, 50)
GUISetState()

While 1
$msg=GUIGetMsg()
If $msg = -3 Then Exit
If $msg = $button Then notepad()
If $msg = $button2 Then click()
WEnd

Func click()
    ControlClick("run notepad","",$button,"left") ;;notice i changed the mouseclick to controlclick, which makes sure it clicks $button
EndFunc

Func notepad()
    Run("notepad.exe")
EndFunc

[spoiler]My UDFs: Login UDF[/spoiler]

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...