zutto Posted May 31, 2008 Posted May 31, 2008 (edited) yeah, i need sme help.. my script is clicking Top left of my screen and i have no idea why :< #include <ImageSearch.au3> ; Opt("WinWaitDelay",100) Opt("MouseClickDelay", 100) Opt("WinTitleMatchMode",4) Opt("WinDetectHiddenText",1) Opt("MouseCoordMode",0) #include <INet.au3> #include <ImageSearch.au3> $x1=0 $y1=0 sleep("5000") $result = _ImageSearch("rway.bmp",0,$x1,$y1,0) if $result=1 Then mouseclick( "left", "227", "244", "30", "100" ) mouseclick( "left", "210", "235", "30", "100" ) mouseclick( "left", "226", "259", "30", "100" ) mouseclick( "left", "235", "241", "30", "100" ) ;227, 244 ;210, 235 ;226, 259 ;235, 241 Else $result = _ImageSearch("resummon.bmp",1,$x1,$y1,0) MouseMove($x1,$y1,3) mouseclick("left") EndIf any hepl ;|? EDIT: i tried, when i am not using imagesearch'es it clicks where it should.. but i have no idea why its not clicking where it should when imagesearch on.. ;< Edited May 31, 2008 by zutto
Moderators SmOke_N Posted May 31, 2008 Moderators Posted May 31, 2008 (edited) you declare $x1 and $y1 as zero. The reason it clicks in top left corner (x = 0, y = 0), is because you are in your "Else" statement where x and y are only zero. Else MsgBox(64, "info", "X Position to click: " & $x1 & @CRLF & "Y Position to click: " & $y1) $result = _ImageSearch("resummon.bmp",1,$x1,$y1,0) MouseMove($x1,$y1,3) mouseclick("left") EndIf Put that message box there to see for yourself. Edited May 31, 2008 by SmOke_N Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer.
zutto Posted May 31, 2008 Author Posted May 31, 2008 you declare $x1 and $y1 as zero. The reason it clicks in top left corner (x = 0, y = 0), is because you are in your "Else" statement where x and y are only zero. Else MsgBox(64, "info", "X Position to click: " & $x1 & @CRLF & "Y Position to click: " & $y1) $result = _ImageSearch("resummon.bmp",1,$x1,$y1,0) MouseMove($x1,$y1,3) mouseclick("left") EndIf Put that message box there to see for yourself. point your attention to bolded area: bolded area is the what its doing, and there is stated coords so.. it should not be clicking at 0,0.. $result = _ImageSearch("rway.bmp",0,$x1,$y1,0) if $result=1 Then mouseclick( "left", "227", "244", "30", "100" ) mouseclick( "left", "210", "235", "30", "100" ) mouseclick( "left", "226", "259", "30", "100" ) mouseclick( "left", "235", "241", "30", "100" ) ;227, 244 ;210, 235 ;226, 259 ;235, 241 Else $result = _ImageSearch("resummon.bmp",1,$x1,$y1,0) MouseMove($x1,$y1,3) mouseclick("left") EndIf
Moderators SmOke_N Posted May 31, 2008 Moderators Posted May 31, 2008 point your attention to bolded area:bolded area is the what its doing, and there is stated coords so.. it should not be clicking at 0,0..$result = _ImageSearch("rway.bmp",0,$x1,$y1,0)if $result=1 Thenmouseclick( "left", "227", "244", "30", "100" )mouseclick( "left", "210", "235", "30", "100" )mouseclick( "left", "226", "259", "30", "100" )mouseclick( "left", "235", "241", "30", "100" );227, 244;210, 235;226, 259;235, 241Else$result = _ImageSearch("resummon.bmp",1,$x1,$y1,0) MouseMove($x1,$y1,3) mouseclick("left")EndIfI told you what it was doing from what we can see... obviously we can't test it.If you put the Msgbox where I told you to, you'd see for yourself. Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer.
zutto Posted May 31, 2008 Author Posted May 31, 2008 (edited) I told you what it was doing from what we can see... obviously we can't test it.If you put the Msgbox where I told you to, you'd see for yourself.did it.. but how i can change it then O,o it used to work..EDIT: how can i get it to work then. since it gives error if no $x1=0$y1=0at the start of script.. Edited May 31, 2008 by zutto
zutto Posted May 31, 2008 Author Posted May 31, 2008 (edited) Bring up my post EDIT: sorry for bumping... figured out howto solve that ;P just made few new &x2=** &y2=** etc sorry for bumping, feel free to delete this thread Edited May 31, 2008 by zutto
Moderators SmOke_N Posted May 31, 2008 Moderators Posted May 31, 2008 BringupmypostPlease don't bump your post more than once every 24 hours. No matter how important it is to you, there are others on the forum that would like assistance as well, and when you bump, you lower their posts.To answer your question... you have to find the position... ImageSearch is not a standard UDF, and I'm not entirely (or at all) familiar with it or what it returns.Bottom line, x and y have to equal something in order for it to click that spot you want, how it equals something is entirely up to you and the functions you use. Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer.
zutto Posted May 31, 2008 Author Posted May 31, 2008 Please don't bump your post more than once every 24 hours. No matter how important it is to you, there are others on the forum that would like assistance as well, and when you bump, you lower their posts.To answer your question... you have to find the position... ImageSearch is not a standard UDF, and I'm not entirely (or at all) familiar with it or what it returns.Bottom line, x and y have to equal something in order for it to click that spot you want, how it equals something is entirely up to you and the functions you use.sorry for it.. figured way to do it btw just made few new &x2=**&y2=** etcsorry for bumping, feel free to delete this thread
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