Ster Posted July 20, 2005 Posted July 20, 2005 I've been searching the forums and have come across some codings that may be usefull, but all the gui32.dll calls are very confusing to me.Simply put i want this function exactly:http://www.autohotkey.com/docs/commands/ImageSearch.htmis there an equivalent in autoIt?
Andre Posted July 20, 2005 Posted July 20, 2005 Hi, the autohotkey has some good things perhaps an idea to combine the 2 into one ? Andre What about Windows without using AutoIt ?It would be the same as driving a car without an steering Wheel!
tuape Posted July 20, 2005 Posted July 20, 2005 Yes, this would be a good function to add. I wouldn't mind if this function would be ripped from AHK, they have used a lot of AutoIt's code
Valik Posted July 20, 2005 Posted July 20, 2005 Yes, this would be a good function to add. I wouldn't mind if this function would be ripped from AHK, they have used a lot of AutoIt's code <{POST_SNAPBACK}>So you want us to throw away our ideals and be a bunch of dirty rat bastards that steal source code? I think that'd be a rather hypocritical thing for us to do given one of the primary reasons AutoIt is closed/limited source is due to a certain group leeching our code without even being courteous enough to ask us first.
Josbe Posted July 20, 2005 Posted July 20, 2005 I think a combination of PixelSearch and PixelChecksum could do something... I will go test...Lar.<{POST_SNAPBACK}>Nice words... I didn't know of this function (at this moment), I don't use AHK...but it's interesting because, looks like this func, works with files.Also, would be nice a GUI function that extracts a region of an image file and can be used like resource over a window... (of course, I believe that could be finished with DLLCall) AUTOIT > AutoIt docs / Beta folder - AutoIt latest beta
tuape Posted July 21, 2005 Posted July 21, 2005 So you want us to throw away our ideals and be a bunch of dirty rat bastards that steal source code? I think that'd be a rather hypocritical thing for us to do given one of the primary reasons AutoIt is closed/limited source is due to a certain group leeching our code without even being courteous enough to ask us first.<{POST_SNAPBACK}>No, that's not what I'm saying. You can always take the high road and ask AHK developer / give him credits on the func description. I'm just saying AHK source code might be worth studying to give ideas how this can be done.@Larry: That's very good but doesn't really do exactly the same (not reading image info from files)A function coded with C++ and added to AutoIt would probably perform much better.
Valik Posted July 21, 2005 Posted July 21, 2005 I'm just saying AHK source code might be worth studying to give ideas how this can be done.This is why reading their source is pointless:I just looked at the ImageSearch function source in AHK and it is a modification of my PixelSearch function from AU3.
JSThePatriot Posted July 21, 2005 Posted July 21, 2005 (edited) I have looked at the whole thing, because I wanted to see who AutoIt's competitor's are, and I noticed they gave Jon some credit, but not very much in their helpfile. They have most everything AutoIt used to offer. I looked at how they had everything setup, and its just like AutoIt... really kinda upset me that someone would do that. They even have a quite large support forum. Its odd. Edit: This seems to be the case with alot of things I have noticed... splits and such, except this isnt a split they just took the source and went with it. I am glad Jon saw this and limited the source code when he did. Competition is one thing, but just taking and claiming it for your own is a totally different story. JS Edited July 21, 2005 by JSThePatriot AutoIt Links File-String Hash Plugin Updated! 04-02-2008 Plugins have been discontinued. I just found out. ComputerGetInfo UDF's Updated! 11-23-2006 External Links Vortex Revolutions Engineer / Inventor (Web, Desktop, and Mobile Applications, Hardware Gizmos, Consulting, and more)
tuape Posted July 21, 2005 Posted July 21, 2005 I didn't mean to step to anyones toes here. I've just been in the forum long enough to know that AHK is taking code from Jon, that's all. @Larry: For test automation image file is better. Humans can easily spot a difference in image file, but not in Pixelchecksum. Maybe both ways could be supported? I myself don't have any specific need at the moment, I'm just saying that this function would be really good add-on...
JSThePatriot Posted July 22, 2005 Posted July 22, 2005 I didn't mean to step to anyones toes here. I've just been in the forum long enough to know that AHK is taking code from Jon, that's all.@Larry: For test automation image file is better. Humans can easily spot a difference in image file, but not in Pixelchecksum. Maybe both ways could be supported?I myself don't have any specific need at the moment, I'm just saying that this function would be really good add-on...<{POST_SNAPBACK}>I know you didnt mean to step on any toes. At the same time this is somewhat a sore subject for the developers, because someone has just taken their code barely gave any recognition to who wrote it, and claiming it as their own.JS AutoIt Links File-String Hash Plugin Updated! 04-02-2008 Plugins have been discontinued. I just found out. ComputerGetInfo UDF's Updated! 11-23-2006 External Links Vortex Revolutions Engineer / Inventor (Web, Desktop, and Mobile Applications, Hardware Gizmos, Consulting, and more)
v1rtu0s1ty Posted July 22, 2005 Posted July 22, 2005 whipped together something similar that should be useful... bad code... uncommented... but works...expandcollapse popup;---------------------------------------------------------------- ;;;;;The very first pixel should be as unique as possible... ;---------------------------------------------------------------- $info = _ImageSearchGetInfo(326,313,339,331) $xy = _ImageSearch(0,0,640,480,$info) If Not @error Then MsgBox(4096,"",$xy[0] & "," & $xy[1]) Func _ImageSearchGetInfo($l,$t,$r,$b) Dim $array[4] $color = PixelGetColor($l, $t) $chksum = PixelChecksum($l, $t, $r, $b) $array[0] = $r - $l $array[1] = $b - $t $array[2] = $color $array[3] = $chksum Return $array EndFunc Func _ImageSearch($left,$top,$width,$height,$ISarray) $x = $left $y = $top $boundX = $left + $width $boundY = (($top + $height) - $ISarray[1]) While $x <= $boundX And $y <= $boundY $initXY = PixelSearch($x, $y, $boundX, $y, $ISarray[2]) If Not @error Then If $ISarray[3] = PixelChecksum($initXY[0], $initXY[1], $initXY[0] + $ISarray[0], $initXY[1] + $ISarray[1]) Then Return $initXY Else If ($initXY[0] + $ISarray[0]) > $boundX Then $y = $y + 1 Else $x = $initXY[0] + 1 EndIf EndIf Else $y = $y + 1 EndIf WEnd SetError(1) EndFunc gotta go get ready for a road trip...Lar.<{POST_SNAPBACK}>Hi Larry,I'm interested in this code you wrote. Which part compares the source image? How is the source image loaded? I'm planning to use it in the script I'm building now since I can't retrieve the classname of a text inside a dialog box.Thanks,Neil
Ster Posted July 22, 2005 Author Posted July 22, 2005 Okay specifically why i wanted this function is that in a game i play, i want to drop items from my inventory based on an original cropped bitmap i would save to file. now a matching image will generally be the same, except the background of the inventory window is not consistent. therefore i require the shade-difference option. if i could understand how to open a bitmap and parse each pixel, say x:1-41 and y:1-41, then i could write my own utility by using pixelsearch. however i do not know how to load a bitmap nor parse each pixel -- if someone could give a breif example of this i would GREATLY APRECIATE it. p.s. i was also thinking of using imagemagick COMPARE but the download seems to be source only files.
v1rtu0s1ty Posted July 22, 2005 Posted July 22, 2005 _ImageSearchGetInfo takes a snapshot and saves th info to an array. You can record this info however you want. pass the array to _ImageSearch along with the left,top pixel and width,height to search.Lar.<{POST_SNAPBACK}>Am I correct that the array passed to _ImageSearch will be used to compare the image or array found in the left,top pixel and width,height supplied?Assuming I have kept a .gif file of the image I want to compare with, how will I load this image? And how will I use your function to compare it?Thanks again!Neil
cmallett Posted July 23, 2005 Posted July 23, 2005 (edited) I just looked at the ImageSearch function source in AHK and it is a modification of my PixelSearch function from AU3.That is false. Both ImageSearch and the fast-mode PixelSearch were written from scratch by Aurelian Maga (and I made some small refinements, such as PNG and transparent-icon support). Anyone wishing proof can download the source code, in which the ImageSearch function can be found by searching script2.cpp for "ImageSearch was created by Aurelian Maga."Edit: Fixed typos. Edited July 23, 2005 by cmallett
Ster Posted July 24, 2005 Author Posted July 24, 2005 [...]if i could understand how to open a bitmap and parse each pixel [...] then i could write my own utility by using pixelsearch. [...] if someone could give a brief example of this i would GREATLY APRECIATE it. [...]<{POST_SNAPBACK}>
tuape Posted August 19, 2005 Posted August 19, 2005 I have to give credit to AHK people about this ImageSearch function. It's fast enough and works very well.
murky024 Posted January 16, 2012 Posted January 16, 2012 Hate to bump a dead thread but is there a way to do this in AutoIt? My search has only yeilded me this and I am not sure I completely understand the use of Larry's function...
Moderators Melba23 Posted January 16, 2012 Moderators Posted January 16, 2012 murky024, Rather than necro a dead thread, please just open a new one next time. You need to sharpen up your searching skills - this popped up as top of the list for me. 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
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