Trejuzz Posted July 19, 2014 Share Posted July 19, 2014 (edited) Hello everyone, I'm trying to learn AutoIt language, but I'm struggling a little, because I can't find a proper learning source, anyways I'm trying to know it better and all it's features, pixel search is really cool one, but the problem with it is that if I'm trying to find exact color (0x000000 for example) it finds a lot of them, what if I want to click on Steam logo or something? Only image search came to my mind, however I have been trying to run it, it doesn't... Can someone please look at my code and tell me what's wrong with it?#include <ImageSearch.au3> Global $x, $y HotKeySet("q", "drag") HotKeySet("-","exits") while 1 sleep(200) WEnd Func drag() $search = _ImageSearch ("5.png",0,$x,$y,0) if $search > 0 Then MouseClick ("left", $x,$y) EndIf EndFunc Func exits() Exit EndFunc Edited July 20, 2014 by Melba23 Fixed font Link to comment Share on other sites More sharing options...
computergroove Posted July 19, 2014 Share Posted July 19, 2014 I think your thread is going to get banned because you are doing something with a game. I think the problem is how you are calling your image. You need to tell autoit the directory location of 5.png. Try: $search = _ImageSearch (@scriptDir & "5.png",0,$x,$y,0) Get Scite to add a popup when you use a 3rd party UDF -> http://www.autoitscript.com/autoit3/scite/docs/SciTE4AutoIt3/user-calltip-manager.html Link to comment Share on other sites More sharing options...
Developers Jos Posted July 19, 2014 Developers Share Posted July 19, 2014 (edited) I think your thread is going to get banned because you are doing something with a game. I isn't is strange you state this and still answer the question? @op, have you read the forum rules? Edited July 19, 2014 by 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. Link to comment Share on other sites More sharing options...
Trejuzz Posted July 19, 2014 Author Share Posted July 19, 2014 (edited) isn't is strange you state this and still answer the question?@op, have you read the forum rules?Yes I did. I think your thread is going to get banned because you are doing something with a game. I think the problem is how you are calling your image. You need to tell autoit the directory location of 5.png. Try: $search = _ImageSearch (@scriptDir & "5.png",0,$x,$y,0)I have been trying to make a statistic program from log file, which is presented in image format. I did try your suggestions, nothing changed tho. Edited July 20, 2014 by Melba23 Fixed font Link to comment Share on other sites More sharing options...
Solution Trejuzz Posted July 19, 2014 Author Solution Share Posted July 19, 2014 (edited) So I played with the code a bit and seems that when I write ones insted of zeros, everything is working.Can anyone tell me, what those parameters exactly mean?$search = _ImageSearch ("5.png",1,$x,$y,1)$search = _ImageSearch ("5.png",0,$x,$y,0) Edited July 20, 2014 by Melba23 Fixed font Link to comment Share on other sites More sharing options...
computergroove Posted July 20, 2014 Share Posted July 20, 2014 From ImageSearch.au3 32 bit: Func _ImageSearch($findImage,$resultPosition,$x, $y,$tolerance, $HBMP=0) ; Parameter(s): ; $findImage - the image to locate on the desktop ; $tolerance - 0 for no tolerance (0-255). Needed when colors of ; image differ from desktop. e.g GIF ; $resultPosition - Set where the returned x,y location of the image is. ; 1 for centre of image, 0 for top left of image ; $x $y - Return the x and y location of the image Get Scite to add a popup when you use a 3rd party UDF -> http://www.autoitscript.com/autoit3/scite/docs/SciTE4AutoIt3/user-calltip-manager.html Link to comment Share on other sites More sharing options...
Moderators Melba23 Posted July 20, 2014 Moderators Share Posted July 20, 2014 Trejuzz,Please use the standard font in future. Thanks for you cooperation. 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...
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