Jump to content

Reletive positions not working right


Brigzzy
 Share

Recommended Posts

Hey all,

I'm trying to make a script to automate some mouse clicks. However I want to be able to use this script on other computers, so I'm trying to use relative positions. I've used the autohotkey window spy program to get the in active window coords, but when I run the script, it's clicking in the wrong place. I'm hoping someone here can tell me what I've done wrong.

while 1
Call ("actualwaterbuy")
WEnd

func actualwaterbuy()
        $nMsg = GUIGetMsg()
    Switch $stackstobuybutton
        Case $nMsg = $stackstobuybutton
    For $1 = 1 To GUICtrlRead($stackstobuyinput)
    Call ("buywater")
    Next
        Case $GUI_EVENT_CLOSE
    Exit
    EndSwitch   
EndFunc

Func buywater()
    AutoItSetOption ( "MouseCoordMode", 0 )
    Call ( "craftfocus" )
    MouseClickDrag ( "left", 313, 542, 110, 223, 0 )
    Sleep (250)
    MouseClick ( "left", 672, 498 )
    Sleep (250)
    MouseClick ( "left", 672, 498 )
    Sleep (250)
    MouseClick ( "left", 645, 497 )
    Sleep (250)
    MouseClick ( "left", 615, 598)
EndFunc

Any help would be appreciated, I'm really at a loss here.

Thanks :D

Link to comment
Share on other sites

  • Developers

I've used the autohotkey window spy program .....

Which program?

Which relative position isn't working? How is it relative?

SciTE4AutoIt3 Full installer Download page   - Beta files       Read before posting     How to post scriptsource   Forum etiquette  Forum Rules 
 
Live for the present,
Dream of the future,
Learn from the past.
  :)

Link to comment
Share on other sites

The AutoIt WIndow info tool gives client coordinates not window coordinates, so I think you need

AutoItSetOption ( "MouseCoordMode", 2 )

not

AutoItSetOption ( "MouseCoordMode", 0 )

Serial port communications UDF Includes functions for binary transmission and reception.printing UDF Useful for graphs, forms, labels, reports etc.Add User Call Tips to SciTE for functions in UDFs not included with AutoIt and for your own scripts.Functions with parameters in OnEvent mode and for Hot Keys One function replaces GuiSetOnEvent, GuiCtrlSetOnEvent and HotKeySet.UDF IsConnected2 for notification of status of connected state of many urls or IPs, without slowing the script.
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...