Sleepyguy Posted March 24, 2016 Share Posted March 24, 2016 I am very new to autoit and have been working my way though problems with wikis but ran into something I can't find online. My goal is to search for a color on screen and then apply offsets to the coordinates. Basically find the colored spot then click low and right of it. Something like this: $sm = PixelSearch( 239, 279, 301, 337, $Green, 15) If Not @error Then MouseClick("PRIMARY", ($sm [0]+20) , ($SMr [1]+20) , 1, 5) Sleep(500) EndIf I likely will have loads more questions as I evolve but for now hope to limit it to this. The target is always lower right but targets move around so I need a moving detection with a constant offset. Link to comment Share on other sites More sharing options...
JohnOne Posted March 25, 2016 Share Posted March 25, 2016 Where does $SMr come from? AutoIt Absolute Beginners Require a serial Pause Script Video Tutorials by Morthawt ipify Monkey's are, like, natures humans. Link to comment Share on other sites More sharing options...
Sleepyguy Posted March 25, 2016 Author Share Posted March 25, 2016 Sorry the $smr is a typo and will be changed. $sm = PixelSearch( 239, 279, 301, 337, $Green, 15) If Not @error Then MouseClick("PRIMARY", ($sm [0]+20) , ($sm [1]+20) , 1, 5) Sleep(500) EndIf Also tried: $sm = PixelSearch( 239, 279, 301, 337, $Green, 15) If Not @error Then $sma = $sm [0] + 30 $smb = @sm [1] + 30 MouseClick("PRIMARY", $sma , $smb , 1, 5) Sleep(500) EndIf Link to comment Share on other sites More sharing options...
Sleepyguy Posted March 25, 2016 Author Share Posted March 25, 2016 I figured it out. Thank you. added Local $sma = $sm [0] + 30 And it works. Likely not cleanest coding but as time progresses I shall learn better. Looking forward to making more advanced scripts as there is loads of tasks at work would like to automate. Like clicking okay, yes, yes, ok, confirm just for a single export. Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now