UncleLouie909 Posted September 29, 2018 Posted September 29, 2018 (edited) Hey guys thanks for attempting to help! Scenario: There is a thin black circle (0x000000) on my screen with a blue background. Problem: When I run my code the mouse always clicks approx 25ish pixels to the right side of it.... Question: Why is mouseClick Getting the location wrong? Can anyone let me know what I am doing wrong? I am fairly new so it may be a beginner mistake. Code: $point = PixelSearch(477,204,584,504,0x000000) if IsArray($point) Then MouseClick("left",$point[0],$point[1]) EndIf Edited September 29, 2018 by UncleLouie909
jdelaney Posted September 29, 2018 Posted September 29, 2018 (edited) Given your example, the mouseclick is going to be exactly where the first black pixel is found within the range provided. Pixel search is a very weak way to determine anything concrete. You can always add in debugging inside the if statement to console output the array's point, and then you can also add in debugging to mousemove to that spot, with the speed option set to 100, so you can see where the range you provided is wrong. Edit: programs don't make mistakes, programmers do. Edited September 29, 2018 by jdelaney IEbyXPATH-Grab IE DOM objects by XPATH IEscriptRecord-Makings of an IE script recorder ExcelFromXML-Create Excel docs without excel installed GetAllWindowControls-Output all control data on a given window.
UncleLouie909 Posted September 29, 2018 Author Posted September 29, 2018 Is there a better method for determining the location of a color and clicking on it?
jdelaney Posted September 29, 2018 Posted September 29, 2018 It all depends on what you are attempting to click. So short answer yes. Long answer, provide details of what you are attempting to interact with. IEbyXPATH-Grab IE DOM objects by XPATH IEscriptRecord-Makings of an IE script recorder ExcelFromXML-Create Excel docs without excel installed GetAllWindowControls-Output all control data on a given window.
UncleLouie909 Posted September 29, 2018 Author Posted September 29, 2018 (edited) I am playing a game written in Java. The location I am providing is plenty big and 100% sure contains the color. The Circle is a think black circle that is over water in the game (a fishing spot). I just want to click the thin black circle or even inside of the circle. Every time I run the program it click way to the right. I just tried the following: I changed the Circle to magenta 0xFF00FF and it did not find the circle. Update: I don't think it is finding the color at all.... This is weird to me because I have used this function successfully many many times. Edited September 29, 2018 by UncleLouie909
jdelaney Posted September 29, 2018 Posted September 29, 2018 You are probably stuck with pixels. Also, there are rules against helping automate games. IEbyXPATH-Grab IE DOM objects by XPATH IEscriptRecord-Makings of an IE script recorder ExcelFromXML-Create Excel docs without excel installed GetAllWindowControls-Output all control data on a given window.
IAMK Posted September 29, 2018 Posted September 29, 2018 Check that your screen's dpi is set to 100%.
Developers Jos Posted September 29, 2018 Developers Posted September 29, 2018 Welcome to the AutoIt forum. Unfortunately you appear to have missed the Forum rules on your way in. Please read them now - particularly the bit about not discussing game automation - and then you will understand why you will get no help and this thread will now be locked. See you soon with a legitimate question I hope. The Moderation team 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.
Moderators JLogan3o13 Posted September 29, 2018 Moderators Posted September 29, 2018 16 hours ago, IAMK said: Check that your screen's dpi is set to 100%. Precisely how many times does someone have to point out that when the thread is obviously against the rules, don't help?! "Profanity is the last vestige of the feeble mind. For the man who cannot express himself forcibly through intellect must do so through shock and awe" - Spencer W. Kimball How to get your question answered on this forum!
Recommended Posts