sill Posted May 1, 2016 Share Posted May 1, 2016 (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 May 1, 2016 by Melba23 Converted to code tags Link to comment Share on other sites More sharing options...
AutoBert Posted May 1, 2016 Share Posted May 1, 2016 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! Link to comment Share on other sites More sharing options...
Moderators Melba23 Posted May 1, 2016 Moderators Share Posted May 1, 2016 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 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...
sill Posted May 1, 2016 Author Share Posted May 1, 2016 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 More sharing options...
AutoBert Posted May 1, 2016 Share Posted May 1, 2016 (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 May 1, 2016 by AutoBert Link to comment Share on other sites More sharing options...
sill Posted May 1, 2016 Author Share Posted May 1, 2016 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 More sharing options...
sill Posted May 8, 2016 Author Share Posted May 8, 2016 Ok, everythink works correctly now. Problem was in this line MsgBox($MB_SYSTEMMODAL, "Mouse x, y:", $aPos[0] & ", " & $aPos[1]) Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now