Jump to content

Recommended Posts

Posted (edited)

"if color ="  doesnt work. That only works when color is pure white or pure black. My code:

#include <MsgBoxConstants.au3>
#include <AutoItConstants.au3>

HotKeySet("{Numpad1}", "start")

While 1
    Sleep(5000)
WEnd

Func start()

    $cyka = PixelGetColor(749, 462)
    If $cyka = 0xB79A62 Then
        MsgBox($MB_SYSTEMMODAL, "ggg", "git")
    Else
        MsgBox($MB_SYSTEMMODAL, "ggg", "chuj")
    EndIf

EndFunc   ;==>start

Func stop()
    Exit
EndFunc   ;==>stop

 

Edited by Melba23
Converted to code tags
Posted

PixelGetColor returns the color of a pixel, if $cyka = works and says it's not the excpected color. So what's the problem? Ask for color of the correct pixel, or test for correct color!

  • Moderators
Posted

sill,

Welcome to the AutoIt forums.

When you post code please use Code tags - see here how to do it.  Then you get a scrolling box and syntax colouring as you can see above now I have added the tags.

M23

Public_Domain.png.2d871819fcb9957cf44f4514551a2935.png 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 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

 

Posted

i forgot about my script for finding a color.

I find my color by this script:

 

#include <MsgBoxConstants.au3>

HotKeySet( "{Numpad2}", "start")
HotKeySet( "{Numpad1}", "start2")


While 1
   Sleep(5000)
   WEnd

func start()
Local $aPos = MouseGetPos()
MsgBox($MB_SYSTEMMODAL, "Mouse x, y:", $aPos[0] & ", " & $aPos[1])
 

endfunc



func start2()



 Local $aPos = MouseGetPos()
Local $iColor = PixelGetColor($aPos[0], $aPos[1])


MsgBox($MB_SYSTEMMODAL, "", "The hex color is: " & Hex($iColor, 6))

endfunc

Then i am writing a cords of mouse and hex color in my first code.

I have windows 7 64 bit. I installed autoit x86 because i cant run my .au3 files when i would like to install x64.

I cant make new .au3 files too.

Posted (edited)

You are using local declared variables for $aPos, also the Mouse can be moved an on a new position. Using $aPos global declared, the script works:

#include <Array.au3>

HotKeySet( "{Esc}", "_exit")
HotKeySet( "{F1}", "start")
HotKeySet( "{F2}", "start2")

Global $aPos

While 1
   Sleep(5000)
   WEnd

func start()
    $aPos = MouseGetPos()
    ReDim $aPos[4]
    $aPos[2]=PixelGetColor($aPos[0],$aPos[1])
    _ArrayDisplay($aPos,"F1")
endfunc



func start2()
    $aPos[3]=PixelGetColor($aPos[0],$aPos[1])
    _ArrayDisplay($aPos,"F2")
endfunc

Func _Exit()
    Exit
EndFunc

if had to change to F1 and F2 key, my netbook has no numpad.

Edited by AutoBert
Posted

Your script works correctly AutoBert but when I change "local" to "global" in my script, this still doesn't work.

Quote

also the Mouse can be moved an on a new position.

When I am clicking numpad1 and numpad2. Mouse is stationary.

Posted

Ok, everythink works correctly now. Problem was in this line

 

MsgBox($MB_SYSTEMMODAL, "Mouse x, y:", $aPos[0] & ", " & $aPos[1])

 

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...