Sign in to follow this  
Followers 0
GalionKnight

Color Hex?

12 posts in this topic

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.

Share this post


Link to post
Share on other sites



C'mon, can't sm1 help?

Share this post


Link to post
Share on other sites

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....

Share this post


Link to post
Share on other sites

I should have explained it better, I want it to find that EXACT color, nothing else but that EXACT color.

Share this post


Link to post
Share on other sites

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

Share this post


Link to post
Share on other sites

Well, I need the coordinates of my whole screeen, how can I get that? I am talking bout the whole screen.

Share this post


Link to post
Share on other sites

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._______My UDFs:

Spoiler

ArrayMultiColSort ---- Sort arrays on multiple columns
ChooseFileFolder ---- Single and multiple selections from specified path treeview listing
Date_Time_Convert -- Easily convert date/time formats, including the language used
ExtMsgBox --------- A highly customisable replacement for MsgBox
GUIExtender -------- Extend and retract multiple sections within a GUI
GUIFrame ---------- Subdivide GUIs into many adjustable frames
GUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView items
GUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeView
Marquee ----------- Scrolling tickertape GUIs
NoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxes
Notify ------------- Small notifications on the edge of the display
Scrollbars ----------Automatically sized scrollbars with a single command
StringSize ---------- Automatically size controls to fit text
Toast -------------- Small GUIs which pop out of the notification area

 

Share this post


Link to post
Share on other sites

#8 ·  Posted (edited)

I'm not sure if this topic is related to

Edit : Typnig!

Edited by Jayson

Share this post


Link to post
Share on other sites

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. :idiot:

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._______My UDFs:

Spoiler

ArrayMultiColSort ---- Sort arrays on multiple columns
ChooseFileFolder ---- Single and multiple selections from specified path treeview listing
Date_Time_Convert -- Easily convert date/time formats, including the language used
ExtMsgBox --------- A highly customisable replacement for MsgBox
GUIExtender -------- Extend and retract multiple sections within a GUI
GUIFrame ---------- Subdivide GUIs into many adjustable frames
GUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView items
GUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeView
Marquee ----------- Scrolling tickertape GUIs
NoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxes
Notify ------------- Small notifications on the edge of the display
Scrollbars ----------Automatically sized scrollbars with a single command
StringSize ---------- Automatically size controls to fit text
Toast -------------- Small GUIs which pop out of the notification area

 

Share this post


Link to post
Share on other sites

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.

Share this post


Link to post
Share on other sites

#11 ·  Posted (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 by Melba23

Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind._______My UDFs:

Spoiler

ArrayMultiColSort ---- Sort arrays on multiple columns
ChooseFileFolder ---- Single and multiple selections from specified path treeview listing
Date_Time_Convert -- Easily convert date/time formats, including the language used
ExtMsgBox --------- A highly customisable replacement for MsgBox
GUIExtender -------- Extend and retract multiple sections within a GUI
GUIFrame ---------- Subdivide GUIs into many adjustable frames
GUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView items
GUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeView
Marquee ----------- Scrolling tickertape GUIs
NoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxes
Notify ------------- Small notifications on the edge of the display
Scrollbars ----------Automatically sized scrollbars with a single command
StringSize ---------- Automatically size controls to fit text
Toast -------------- Small GUIs which pop out of the notification area

 

Share this post


Link to post
Share on other sites

@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


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

Share this post


Link to post
Share on other sites
Guest
This topic is now closed to further replies.
Sign in to follow this  
Followers 0