Sobiech Posted January 16, 2010 Share Posted January 16, 2010 Hi Today i need help with clicking by Pixel Color I am trying to use PixelSearch and i dont know hot to focus his attention on Paint window (example ofc ^^) or other windows. I tried this #Include <Misc.au3> $IC_Unique0 = 0x5C584D $IC_Unique1 = 0x8E8478 HotKeySet("{F1}", "_Exit") While 1 If _IsPressed(12) Then ; 12 = ALT PixelSearch(>>HERE I must write something, what will focus coords to Paint window <<, $IC_Unique0 Or $IC_Unique1) If @error Then MsgBox(0, ":)", "Found") EndIf EndIf WEnd Func _Exit() Exit EndFunc I think this isnt hard, but i dont have any idea ;\ This world is crazy Link to comment Share on other sites More sharing options...
PsaltyDS Posted January 16, 2010 Share Posted January 16, 2010 What does the help file say under PixelSearch(), about the hwnd parameter... Valuater's AutoIt 1-2-3, Class... Is now in Session!For those who want somebody to write the script for them: RentACoder"Any technology distinguishable from magic is insufficiently advanced." -- Geek's corollary to Clarke's law Link to comment Share on other sites More sharing options...
Sobiech Posted January 16, 2010 Author Share Posted January 16, 2010 What does the help file say under PixelSearch(), about the hwnd parameter... #Include <Misc.au3> Opt("MouseCoordMode", 2) Opt("PixelCoordMode", 2) $IC_Unique0 = 0x5C584D $IC_Unique1 = 0x8E8478 $Title = "Diablo II" HotKeySet("{F1}", "_Exit") While 1 If _IsPressed(12) Then Sleep(1000) $coord = PixelSearch(0, 0, 800, 600, $IC_Unique0 Or $IC_Unique1, "", "", $title) MouseClick("left", $coord[0], $coord[1]) If Not @Error Then MsgBox(0, "Found...", "Unique") EndIf EndIf WEnd Func _Exit() Exit EndFunc Example on Game Window But seems doesnt work >"C:\Program Files (x86)\AutoIt3\SciTE\..\autoit3.exe" /ErrorStdOut "C:\Users\UserName\Desktop\Pickit.au3" C:\Users\Flames\Desktop\Pickit.au3 (21) : ==> Subscript used with non-Array variable.: MouseClick("left", $coord[0], $coord[1]) MouseClick("left", $coord^ ERROR >Exit code: 1 Time: 2.811 This world is crazy Link to comment Share on other sites More sharing options...
PsaltyDS Posted January 17, 2010 Share Posted January 17, 2010 I don't care why it isn't working on a game, but you should always check the validity of a returned array before using it. Check the result with something like: If @error = 0 Then ; ... EndIf - or - If IsArray($coord) Then ; ... EndIf Valuater's AutoIt 1-2-3, Class... Is now in Session!For those who want somebody to write the script for them: RentACoder"Any technology distinguishable from magic is insufficiently advanced." -- Geek's corollary to Clarke's law Link to comment Share on other sites More sharing options...
Sobiech Posted January 17, 2010 Author Share Posted January 17, 2010 Hmm where is difference between If Not @error or If @error = 0 ?? Anyway i know, this PixelSearch working good, but not finding color :mellow I will try to change some values of color but now i must go away Cu This world is crazy Link to comment Share on other sites More sharing options...
PsaltyDS Posted January 17, 2010 Share Posted January 17, 2010 The difference is you didn't check that until AFTER you tried to use the $coord array: $coord = PixelSearch(0, 0, 800, 600, $IC_Unique0 Or $IC_Unique1, "", "", $title) MouseClick("left", $coord[0], $coord[1]) Should have been: $coord = PixelSearch(0, 0, 800, 600, $IC_Unique0 Or $IC_Unique1, "", "", $title) If @error Then MsgBox(16, "Error", "Pixel not found") Else MouseClick("left", $coord[0], $coord[1]) ; ... EndIf Valuater's AutoIt 1-2-3, Class... Is now in Session!For those who want somebody to write the script for them: RentACoder"Any technology distinguishable from magic is insufficiently advanced." -- Geek's corollary to Clarke's law Link to comment Share on other sites More sharing options...
Sobiech Posted January 17, 2010 Author Share Posted January 17, 2010 Ok, but i know that, I have error :DDDD I just dont know why :| This world is crazy Link to comment Share on other sites More sharing options...
PsaltyDS Posted January 19, 2010 Share Posted January 19, 2010 First, you passed a string title instead of the handle to the hwnd parameter. Second, it's a game. Probably has GameGuard or similar blocking on it. Third, it's a game script. How did I let myself get sucked into this...? Valuater's AutoIt 1-2-3, Class... Is now in Session!For those who want somebody to write the script for them: RentACoder"Any technology distinguishable from magic is insufficiently advanced." -- Geek's corollary to Clarke's law Link to comment Share on other sites More sharing options...
Sobiech Posted January 19, 2010 Author Share Posted January 19, 2010 Second, it's a game. Probably has GameGuard or similar blocking on it.Nope, i am 100% sure that method in this game can be done by AutoIT and Pixel colors (there are many aplications for this in Au)Third, it's a game script. How did I let myself get sucked into this...? I dont know ^^ Maybe you playied in games Anyway thx for any help This world is crazy 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