lioncool Posted March 31, 2016 Posted March 31, 2016 i want getpixelcolor background in bluestack why doesnt click at position the code not work right sometime always click at position #include <Color.au3> #include <Math.au3> #include <ButtonConstants.au3> #include <GUIConstantsEx.au3> #include <WindowsConstants.au3> #include <GDIPlus.au3> #Region ### START Koda GUI section ### Form= $frm = GUICreate("Test", 240, 73, 523, 402) $Start = GUICtrlCreateButton("Start", 16, 16, 97, 33) $Stop = GUICtrlCreateButton("Stop", 128, 16, 89, 33) GUISetState(@SW_SHOW) #EndRegion ### END Koda GUI section ### Global $hBitmap; Image for pixel functions Global $hHBitmap; Handle Image for pixel functions While 1 $nMsg = GUIGetMsg() Switch $nMsg Case $GUI_EVENT_CLOSE Exit Case $Start If _ColorCheck(_GetPixelColor(572, 747), Hex(0xB6CFC7, 6), 1) Then ToolTip('woot work',0,0) MouseClick("left", 572, 747, 1 ,1) EndIf Case $Stop Exit EndSwitch WEnd Func _ColorCheck($nColor1, $nColor2, $sVari = 5); checking match between 2 colors (with a variance degree) Local $Red1, $Red2, $Blue1, $Blue2, $Green1, $Green2 $Red1 = Dec(StringMid(String($nColor1), 1, 2)) $Blue1 = Dec(StringMid(String($nColor1), 3, 2)) $Green1 = Dec(StringMid(String($nColor1), 5, 2)) $Red2 = Dec(StringMid(String($nColor2), 1, 2)) $Blue2 = Dec(StringMid(String($nColor2), 3, 2)) $Green2 = Dec(StringMid(String($nColor2), 5, 2)) If Abs($Blue1 - $Blue2) > $sVari Then Return False If Abs($Green1 - $Green2) > $sVari Then Return False If Abs($Red1 - $Red2) > $sVari Then Return False Return True EndFunc Func _GetPixelColor($iX, $iY);Get the piwel colors at specific coordinate _GDIPlus_Startup(); Initialize GDI+ library Local $aPixelColor = _GDIPlus_BitmapGetPixel($hBitmap, $iX, $iY) _GDIPlus_Shutdown(); Shut down GDI+ library Return Hex($aPixelColor, 6) EndFunc ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- >>>> Window <<<< Title: BlueStacks App Player Class: WindowsForms10.Window.8.app.0.33c0d9d Position: 20, 20 Size: 866, 749 Style: 0x16CA0000 ExStyle: 0x00050100 Handle: 0x00000000003D1620 >>>> Control <<<< Class: Instance: ClassnameNN: Name: Advanced (Class): ID: Text: Position: Size: ControlClick Coords: Style: ExStyle: Handle: >>>> Mouse <<<< Position: 840, 629 Cursor ID: 0 Color: 0xB6CFC7 getpixelcolor background.au3
Developers Jos Posted March 31, 2016 Developers Posted March 31, 2016 Please ensure you read our forumrules, specifically the section about game automation. 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.
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