Sign in to follow this  
Followers 0
Brigzzy

Reletive positions not working right

4 posts in this topic

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

Share this post


Link to post
Share on other sites



#2 ·  Posted (edited)

I thought that you are very authentic ******

Edited by Jos
removed link - What was it doing there ?

Share this post


Link to post
Share on other sites

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

Which program?

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


Visit the SciTE4AutoIt3 Download page for the latest versions  - Beta files                                How to post scriptsource        Forum Rules
 
Live for the present,
Dream of the future,
Learn from the past.
  :)

Share this post


Link to post
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.

Share this post


Link to post
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
Sign in to follow this  
Followers 0