Jump to content

If color doesnt work


Recommended Posts

"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
Link to comment
Share on other sites

  • Moderators

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

 

Link to comment
Share on other sites

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.

Link to comment
Share on other sites

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
Link to comment
Share on other sites

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.

Link to comment
Share on other sites

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
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...