GalionKnight Posted February 21, 2011 Share Posted February 21, 2011 I'm having difficulty with color hex codes. Sleep(5000) Global $iColor = 0xcbe1ba, $f_Found = False For $iVariation = 1 To 20 Step 10 $avCoord = PixelSearch(400, 250, 650, 400, $iColor, $iVariation) If @error = 0 Then MouseClick("left", $avCoord[0], $avCoord[1]) Sleep(3000) MouseClick("left", $avCoord[0], $avCoord[1]) $f_Found = True ExitLoop EndIf Next If $f_Found Then MsgBox(64, "Found", "Color " & $iColor & " found at " & $avCoord[0] & "\" & $avCoord[1]) Else MsgBox(16, "Not Found", "Color " & $iColor & " not found.") EndIf In the coding, I want my mouse to click the color cbe1ba on a webpage (I used a program called color detector) that has the color. But it can never find it. I have a feeling I gotta fix something here: For $iVariation = 1 To 20 Step 10 I have tried it with several other colors but it will chose one within a range instead of the original one. Link to comment Share on other sites More sharing options...
GalionKnight Posted February 21, 2011 Author Share Posted February 21, 2011 C'mon, can't sm1 help? Link to comment Share on other sites More sharing options...
knaveen Posted February 22, 2011 Share Posted February 22, 2011 I'm having difficulty with color hex codes. Sleep(5000) Global $iColor = 0xcbe1ba, $f_Found = False For $iVariation = 1 To 20 Step 10 $avCoord = PixelSearch(400, 250, 650, 400, $iColor, $iVariation) If @error = 0 Then MouseClick("left", $avCoord[0], $avCoord[1]) Sleep(3000) MouseClick("left", $avCoord[0], $avCoord[1]) $f_Found = True ExitLoop EndIf Next If $f_Found Then MsgBox(64, "Found", "Color " & $iColor & " found at " & $avCoord[0] & "\" & $avCoord[1]) Else MsgBox(16, "Not Found", "Color " & $iColor & " not found.") EndIf In the coding, I want my mouse to click the color cbe1ba on a webpage (I used a program called color detector) that has the color. But it can never find it. I have a feeling I gotta fix something here: For $iVariation = 1 To 20 Step 10 I have tried it with several other colors but it will chose one within a range instead of the original one. Is this a problem only when trying to find the color in a webpage or in all other applications?. Also what happens when you point it to the hwnd (In case the webpage was not active) On the other hand, can you check the return of the command "PixelGetColor" just to confirm is if this a problem with just the "PixelSearch" function or the color itself if not being read.... Link to comment Share on other sites More sharing options...
GalionKnight Posted February 22, 2011 Author Share Posted February 22, 2011 I should have explained it better, I want it to find that EXACT color, nothing else but that EXACT color. Link to comment Share on other sites More sharing options...
Bowmore Posted February 22, 2011 Share Posted February 22, 2011 there is nothing wrong with the code you have posted. If the colour exists in the area searched then it will be found. Perhaps there error is elsewhere in your script. If you only want to find exactly that colour then don't use shade variation, Sleep(5000) Global $iColor = 0xcbe1ba, $f_Found = False $avCoord = PixelSearch(400, 250, 650, 400, $iColor) If @error = 0 Then MouseClick("left", $avCoord[0], $avCoord[1]) Sleep(3000) MouseClick("left", $avCoord[0], $avCoord[1]) $f_Found = True EndIf If $f_Found Then MsgBox(64, "Found", "Color " & $iColor & " found at " & $avCoord[0] & "\" & $avCoord[1]) Else MsgBox(16, "Not Found", "Color " & $iColor & " not found.") EndIf "Programming today is a race between software engineers striving to build bigger and better idiot-proof programs, and the universe trying to build bigger and better idiots. So far, the universe is winning."- Rick Cook Link to comment Share on other sites More sharing options...
GalionKnight Posted February 22, 2011 Author Share Posted February 22, 2011 Well, I need the coordinates of my whole screeen, how can I get that? I am talking bout the whole screen. Link to comment Share on other sites More sharing options...
Moderators Melba23 Posted February 22, 2011 Moderators Share Posted February 22, 2011 GalionKnight,I need the coordinates of my whole screeen, how can I get that?Use the macros @DesktopWidth and @DesktopHeight. M23 Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind Open spoiler to see my UDFs: Spoiler ArrayMultiColSort ---- Sort arrays on multiple columnsChooseFileFolder ---- Single and multiple selections from specified path treeview listingDate_Time_Convert -- Easily convert date/time formats, including the language usedExtMsgBox --------- A highly customisable replacement for MsgBoxGUIExtender -------- Extend and retract multiple sections within a GUIGUIFrame ---------- Subdivide GUIs into many adjustable framesGUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView itemsGUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeViewMarquee ----------- Scrolling tickertape GUIsNoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxesNotify ------------- Small notifications on the edge of the displayScrollbars ----------Automatically sized scrollbars with a single commandStringSize ---------- Automatically size controls to fit textToast -------------- Small GUIs which pop out of the notification area Link to comment Share on other sites More sharing options...
Jayson Posted February 23, 2011 Share Posted February 23, 2011 (edited) I'm not sure if this topic is related to Edit : Typnig! Edited February 23, 2011 by Jayson Link to comment Share on other sites More sharing options...
Moderators Melba23 Posted February 23, 2011 Moderators Share Posted February 23, 2011 Jayson,As the OP has not indicated that this is in any way related to gaming I am prepared to give him the benefit of the doubt. If someone can ask a question and give some sample code without it being obviously game-related I am happy to help - even if, as in this case, the use of PixelSearch is a possible clue. Unless we ask every member to swear on oath that their post is not in any way, shape or form dealing with a game we can do no more. It is the topics with the give-away words like "bot", "spell", "health", etc that need to be reported. After all if we do not protect the EULAs of others, how can we expect our own to be respected? Nothing personal there, just my opinion. Have a good evening. M23 Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind Open spoiler to see my UDFs: Spoiler ArrayMultiColSort ---- Sort arrays on multiple columnsChooseFileFolder ---- Single and multiple selections from specified path treeview listingDate_Time_Convert -- Easily convert date/time formats, including the language usedExtMsgBox --------- A highly customisable replacement for MsgBoxGUIExtender -------- Extend and retract multiple sections within a GUIGUIFrame ---------- Subdivide GUIs into many adjustable framesGUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView itemsGUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeViewMarquee ----------- Scrolling tickertape GUIsNoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxesNotify ------------- Small notifications on the edge of the displayScrollbars ----------Automatically sized scrollbars with a single commandStringSize ---------- Automatically size controls to fit textToast -------------- Small GUIs which pop out of the notification area Link to comment Share on other sites More sharing options...
GalionKnight Posted February 24, 2011 Author Share Posted February 24, 2011 I'm not sure if this topic is related to Edit : Typnig!Yes, I am using auto it to type macros. I don't care for using it to type up others apps for I will use C# for that crap. I don't feel like getting stalked or anything. I just wanna learn to program autoit3. I was thinking bout using it for some of my games trying to make auto path systems so people don't have to spend those long minutes traveling across the land hehehehe. Link to comment Share on other sites More sharing options...
Moderators Melba23 Posted February 24, 2011 Moderators Share Posted February 24, 2011 (edited) GalionKnight, In that case, you are not welcome here. As you have already been told, this forum does not support automating games. M23 Edit: Jayson, Looks like you were right in this case, but my post above is still valid in general as confirmed by the Mods last night. Edited February 24, 2011 by Melba23 Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind Open spoiler to see my UDFs: Spoiler ArrayMultiColSort ---- Sort arrays on multiple columnsChooseFileFolder ---- Single and multiple selections from specified path treeview listingDate_Time_Convert -- Easily convert date/time formats, including the language usedExtMsgBox --------- A highly customisable replacement for MsgBoxGUIExtender -------- Extend and retract multiple sections within a GUIGUIFrame ---------- Subdivide GUIs into many adjustable framesGUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView itemsGUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeViewMarquee ----------- Scrolling tickertape GUIsNoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxesNotify ------------- Small notifications on the edge of the displayScrollbars ----------Automatically sized scrollbars with a single commandStringSize ---------- Automatically size controls to fit textToast -------------- Small GUIs which pop out of the notification area Link to comment Share on other sites More sharing options...
Developers Jos Posted February 24, 2011 Developers Share Posted February 24, 2011 @GalionKnight,Does this ring a bell?Didn't think peeps where gonna be such jerks here. That topic was obviously there and I don't really feel like being treated stupid. I was actually making a goal to make my own game...Let me be that jerk and give you the final warning by giving you a posting ban of 5 days.Don't come back when the only topic for you is games bots.Jos 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 More sharing options...
Recommended Posts