kevilex Posted March 19, 2018 Share Posted March 19, 2018 Hey, I have an interesting issue where I have tried to make a script where it takes a picture of a part of my monitor in which I have saved to $test, and after doing so, it would image search another part of the monitor for the same image. After checking if it is on the other part of the monitor, it would call my function Yes or the function No, based on the . After some trial and error I ended up with this code (sorry for the delays). I put this in the scenario that it was intended for and I quickly realized that the $test image was slightly bigger at one side of the monitor. This got me wondering if I could make it in any other ways, the picture is based on numbers and text, so therefore I am wondering there's an easy way of adding a font to an image search where it would recognize the numbers and values for then to compare to each other. I'm sorry if I am missing some key points, this is one of my first scripts (, absolute first with image search) and I am really excited to get this working! While $loop <> 5 FFSnapShot (655, 576, 697, 604, 1, "test" ) Sleep(1000) FFApplyFilterOnSnapshot( 0, 0, 0, 1) Sleep(1000) FFSaveBMP ("test") Sleep(1000) $search = _ImageSearchArea("test.bmp",1,553, 224, 794, 462, $x, $y, 10,$HBMP=0) Sleep(1000) If $search = 1 Then Sleep(1000) Call(Yes) Else Sleep(1000) Call(No) EndIf Sleep(1000) FileDelete ( @DesktopDir test.bmp" ) WEnd Link to comment Share on other sites More sharing options...
kevilex Posted March 19, 2018 Author Share Posted March 19, 2018 expandcollapse popup#include <ImageSearch.au3> #include "FastFind.au3" #include <GDIPlus.au3> HotKeySet("q", "MyExit") $x = 0 $y = 0 $loop = 1 $yesx = 795 $yesy = 577 $nox = 553 $noy = 566 $Number = @ScriptDir & "test.bmp" $HBMP = 0 WinActivate ("test") While $loop <> 5 FFSnapShot (655, 576, 697, 604, 1, "test" ) Sleep(1000) FFApplyFilterOnSnapshot( 0, 0, 0, 1) Sleep(1000) FFSaveBMP ("Number") Sleep(1000) $search = _ImageSearchArea("Number.bmp",1,553, 224, 794, 462, $x, $y, 10,$HBMP=0) Sleep(1000) If $search = 1 Then Sleep(1000) Call(Yes) Else Sleep(1000) Call(No) EndIf Sleep(1000) FileDelete ( @ScriptDir number.bmp" ) WEnd Func yes() MouseClick("left", $yesx, $yesy) EndFunc func No() MouseClick("left", $nox, $noy) EndFunc Func MyExit () Exit EndFunc Here you have the full code, couldn't edit the post for some reason, sorry! Link to comment Share on other sites More sharing options...
Developers Jos Posted March 19, 2018 Developers Share Posted March 19, 2018 @kevilex, Moved to the appropriate forum, as the DEV forum very clearly states: {Do not create AutoIt-related topics here, use AutoIt General Help and Support} 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...
kevilex Posted March 19, 2018 Author Share Posted March 19, 2018 2 minutes ago, Jos said: @kevilex, Moved to the appropriate forum Don't know the difference, but thanks! Link to comment Share on other sites More sharing options...
Developers Jos Posted March 19, 2018 Developers Share Posted March 19, 2018 (edited) 6 minutes ago, kevilex said: Don't know the difference, but thanks! Which part of that quoted line is unclear to you as I would think it is pretty strait forward.... no? Your script has several syntax errors and logic errors, so aren't you getting errors when running it? Jos Edited March 19, 2018 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...
kevilex Posted March 19, 2018 Author Share Posted March 19, 2018 1 minute ago, Jos said: Your script has several syntax errors and logic errors, so aren't you getting errors when running it? Yeah, it runs Link to comment Share on other sites More sharing options...
kevilex Posted March 19, 2018 Author Share Posted March 19, 2018 I have tested both when it should call the yes and no function, it works perfectly. The problem is just that the thing it was supposed to find was another size, and I need a fix for that ^^ Link to comment Share on other sites More sharing options...
Moderators JLogan3o13 Posted March 19, 2018 Moderators Share Posted March 19, 2018 How about some explanation as to what you're actually trying to accomplish. You are finding one of the many reasons not to use image/pixel search unless there are no alternatives. I guarantee there is a better way to accomplish what you are after. "Profanity is the last vestige of the feeble mind. For the man who cannot express himself forcibly through intellect must do so through shock and awe" - Spencer W. Kimball How to get your question answered on this forum! Link to comment Share on other sites More sharing options...
kevilex Posted March 19, 2018 Author Share Posted March 19, 2018 I am new to coding, therefore just chosing a task and trying to complete it in the easiest way possible. In my case, I like to practice this in flashgames, I've done several games where pixelsearch have done me plenty, but at this game I can't seem to do the same thing because the dimensions is off and it's based off of numbers in which has to be read. The game is hard to do a DOM explore search for the elements because it is all like a giant picture, therefore making me go into the sourcecode, where I have next to no clue what's going on. So what I am trying to do is to get some practice in coding thoughtprocess and general syntaxes. I would highly appreciate some help with this as I want to learn more about more advanced stuff. I know that games are not allowed to be cheated on this website, but since it is a flashgame and I am not going to embarrase myself by publicly posting it, why not learn with it now that I am done making calculators, etc. The game is Bingo on facebook if you want to help me, either I need some way of getting the numbers to match up with each other, or I am going to need the element. Link to comment Share on other sites More sharing options...
Moderators Melba23 Posted March 19, 2018 Moderators Share Posted March 19, 2018 kevilex, Unfortunately you appear to have missed the Forum rules on your way in. Please read them now - particularly the bit about not discussing game automation - and then you will understand why you will get no help and this thread will now be locked. See you soon with a legitimate question I hope. 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