Jump to content
Reizvoller

ImageSearch Script Closing w/ Error

Recommended Posts

Reizvoller

Hello,

I am back once again to ask for assistance. I am just trying to fool around with the "ImageSearch" function in order to detect when certain elements appear on my active window to then respond to. To begin testing this I simply cut out a small segment of my background, saved it as a BMP, and used that as the bmp for the search function. I had hoped for it to just run through quickly and say it found it and spit out the X Y coords of where it was found. Instead I am getting this : http://screencast.com/t/MD9aOzPhETE

Here's my script thus far :

#Include <msgBoxConstants.au3>
#Include <ImageSearch.au3>

global $x = 0
global $y = 0
CheckForImage ()
Func checkForImage ()
   Local $Search = _ImageSearchArea ('ninjaCheck.bmp', 1, 0, 0, 1366, 768, $x, $y, 100)
   If $Search = 1 Then
      MsgBox ($IDOK,"Found",$resultPosition)
   EndIf
EndFunc
While 1
   Sleep (10)
WEnd

What I would like assistance with is how do I "Debug" this in order to see where/why it is failing.

I've reviewed https://www.autoitscript.com/wiki/FAQ#How_can_I_debug_my_script.3F but I am not entirely sure how to apply the information. If I could get a return on "Hey, this Func or This Line is where I died" , that would be awesome.

Any suggestions on how I can tackle this issue?

Thank you for your time!

-Reiz

 

checkNinja.bmp is " " around it now and it has the same result 

Edited by Reizvoller
I changed and tested my scripting

Share this post


Link to post
Share on other sites
AutoBert

Maybe the Ninja is against checking and killed your script?

Share this post


Link to post
Share on other sites
Melba23

Reizvoller,

Given the name of the image for which you are checking, you might like to read the Forum rules before you post again.

M23


Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind._______My UDFs:

Spoiler

ArrayMultiColSort ---- Sort arrays on multiple columns
ChooseFileFolder ---- Single and multiple selections from specified path treeview listing
Date_Time_Convert -- Easily convert date/time formats, including the language used
ExtMsgBox --------- A highly customisable replacement for MsgBox
GUIExtender -------- Extend and retract multiple sections within a GUI
GUIFrame ---------- Subdivide GUIs into many adjustable frames
GUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView items
GUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeView
Marquee ----------- Scrolling tickertape GUIs
NoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxes
Notify ------------- Small notifications on the edge of the display
Scrollbars ----------Automatically sized scrollbars with a single command
StringSize ---------- Automatically size controls to fit text
Toast -------------- Small GUIs which pop out of the notification area

 

Share this post


Link to post
Share on other sites
Reizvoller
16 hours ago, Melba23 said:

Reizvoller,

Given the name of the image for which you are checking, you might like to read the Forum rules before you post again.

M23

Howdy!

"Given the name of the image for which you are checking" , I am guessing that is referencing "ninjaCheck.bmp".

I've reviewed the forum rules, as you suggested, but... I don't see what you are trying to say to me. This isn't an attempt at being facetious or evading but honestly asking for guidance with what you are saying to me. Thank you!

Share this post


Link to post
Share on other sites
Jos
8 minutes ago, Reizvoller said:

what you are saying to me

Thought that would be pretty obvious...right.. as your guess is correct?
In case it isn't clear then read the part about Game automation.

Jos


Visit the SciTE4AutoIt3 Download page for the latest versions  - Beta files                                How to post scriptsource        Forum Rules
 
Live for the present,
Dream of the future,
Learn from the past.
  :)

Share this post


Link to post
Share on other sites
Reizvoller
4 minutes ago, Jos said:

Thought that would be pretty obvious...right.. as your guess is correct?
In case it isn't clear then read the part about Game automation.

Jos

Okay, I have done so. How does this apply to me? 
When did I reference a game in my posts? 

"To begin testing this I simply cut out a small segment of my background, saved it as a BMP, and used that as the bmp for the search function." 

So...Am I being told to review rules rather than getting actual replies regarding my question due to an assumption that I am trying to automate game processes?

I've attached a copy of my desktop background and the segment I cut out to hopefully further emphasise the fact that I am not breaking any rules... 

d092ecd9fae122c90aedd6734647ef23.jpg

ninjaCheck.bmp

Edited by Reizvoller
More evidence

Share this post


Link to post
Share on other sites
Jos
3 minutes ago, Reizvoller said:

Okay, I have done so. How does this apply to me? 

You have just been pointed to the rules since you used a term used in games.
In case we were convinced it was against our rules, you wouldn't have been able to post in it anymore, as we would have closed it already.

Jos


Visit the SciTE4AutoIt3 Download page for the latest versions  - Beta files                                How to post scriptsource        Forum Rules
 
Live for the present,
Dream of the future,
Learn from the past.
  :)

Share this post


Link to post
Share on other sites
Reizvoller
1 minute ago, Jos said:

You have just been pointed to the rules since you used a term used in games.
In case we were convinced it was against our rules, you wouldn't have been able to post in it anymore, as we would have closed it already.

Jos

Hello,

So assumptions were made rather than asking questions for clarification. I understand.

I'd like to bring this thread back on topic since we now validated it as an actual question that doesn't break the rules.

#Include <msgBoxConstants.au3>
#Include <ImageSearch.au3>

global $x = 0
global $y = 0
CheckForImage ()
Func checkForImage ()
   Local $Search = _ImageSearch ("ninjaCheck.bmp", 1, $x, $y, 50)
   If $Search = 1 Then
      MsgBox ($IDOK,"Found",$resultPosition)
   EndIf
EndFunc
While 1
   Sleep (10)
WEnd

I've re-modified my script to try the _ImageSearch function rather than _ImageSearchArea . This tosses the same error pop-up that I linked to in my original post. 

Share this post


Link to post
Share on other sites
Jos
Just now, Reizvoller said:

So assumptions were made rather than asking questions for clarification. I understand.

What about you step of your high horse before continuing?
This is our standard approach and when you don't like then that is your problem... sorry. ;) 

Jos


Visit the SciTE4AutoIt3 Download page for the latest versions  - Beta files                                How to post scriptsource        Forum Rules
 
Live for the present,
Dream of the future,
Learn from the past.
  :)

Share this post


Link to post
Share on other sites
Reizvoller
1 minute ago, Jos said:

What about you step of your high horse before continuing?
This is our standard approach and when you don't like then that is your problem... sorry. ;) 

Jos

To iterate again... I'd like to bring this thread back on topic since we now validated it as an actual question that doesn't break the rules.

#Include <msgBoxConstants.au3>
#Include <ImageSearch.au3>

global $x = 0
global $y = 0
CheckForImage ()
Func checkForImage ()
   Local $Search = _ImageSearch ("ninjaCheck.bmp", 1, $x, $y, 50)
   If $Search = 1 Then
      MsgBox ($IDOK,"Found",$resultPosition)
   EndIf
EndFunc
While 1
   Sleep (10)
WEnd

I've re-modified my script to try the _ImageSearch function rather than _ImageSearchArea . This tosses the same error pop-up that I linked to in my original post. 

Jos : You are a skilled developer , do you have any insight you can provide regarding this?

Share this post


Link to post
Share on other sites
Jos
1 minute ago, Reizvoller said:

To iterate again.

 

1 minute ago, Reizvoller said:

Jos : You are a skilled developer , do you have any insight you can provide regarding this?

Seriously...   after first trying to tell me to shut up?  
simple answer: No

Jos


Visit the SciTE4AutoIt3 Download page for the latest versions  - Beta files                                How to post scriptsource        Forum Rules
 
Live for the present,
Dream of the future,
Learn from the past.
  :)

Share this post


Link to post
Share on other sites
Reizvoller
8 minutes ago, Jos said:

 

Seriously...   after first trying to tell me to shut up?  
simple answer: No

Jos

Howdy,

I am sorry you somehow feel that my posts were saying "Shut up" to you. Could you cite the exact line that suggests that notion? I'd rather not make that impression again in the future.

Regarding your reply I accept it and thank you for taking the time to respond.

Now, to iterate once again to get this thread back on topic...

After manipulating my script multiple times and running it in two different environments with clean installs of AutoIt I have come to the conclusion that the library of ImageSearch.au3 is erroneous and I've reached out to the developer of said script. If I get any useful information in return I will post it here so everyone may have said information.

-Reiz 

Share this post


Link to post
Share on other sites
Jos

 

Just now, Reizvoller said:

Now, to iterate once again to get this thread back on topic...

... ahh that is why you reported me. It never dawned on you that I wouldn't appreciate you keep on going on and on about it.

Let me help you to stop this BS

*click*


Visit the SciTE4AutoIt3 Download page for the latest versions  - Beta files                                How to post scriptsource        Forum Rules
 
Live for the present,
Dream of the future,
Learn from the past.
  :)

Share this post


Link to post
Share on other sites
Melba23

Reizvoller,

I would strongly suggest a serious change of attitude if you want to stick around here.

You posted a question using a filename which in our experience indicated that the question was against the forum rules. Rather then simply assuming that the question was game-related and closing the thread, I gently pointed you to the Forum rules so as to prevent any future unpleasantness. I fail to see why you have suddenly become all excited and started acting as if we had come over all heavy-handed. What you saw was our normal response when we have doubts about a question - all you needed to do was to assure us that your question was legal and we could have avoided a great deal of annoyance all round. As it is you have managed to alienate 2 of the Mods here in fairly short order - pretty good going after only 9 posts.

So I suggest you wind your neck very firmly back in and try in future not to take unwarranted offence when absolutely none has been offered.

M23

 

 

  • Like 2

Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind._______My UDFs:

Spoiler

ArrayMultiColSort ---- Sort arrays on multiple columns
ChooseFileFolder ---- Single and multiple selections from specified path treeview listing
Date_Time_Convert -- Easily convert date/time formats, including the language used
ExtMsgBox --------- A highly customisable replacement for MsgBox
GUIExtender -------- Extend and retract multiple sections within a GUI
GUIFrame ---------- Subdivide GUIs into many adjustable frames
GUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView items
GUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeView
Marquee ----------- Scrolling tickertape GUIs
NoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxes
Notify ------------- Small notifications on the edge of the display
Scrollbars ----------Automatically sized scrollbars with a single command
StringSize ---------- Automatically size controls to fit text
Toast -------------- Small GUIs which pop out of the notification area

 

Share this post


Link to post
Share on other sites
Guest
This topic is now closed to further replies.

  • Similar Content

    • lenclstr746
      By lenclstr746
      Hi guys,
      Some functions of my script are running slowly. Very slow. What is the reason?
      My Code:
      <snip>
    • valdemar1977
      By valdemar1977
      Dbug is graphical debugger for AutoIt.
      Project started by @Heron in 2009 and now supported by @asdf8 and @valdemar1977.
      Features
      Debug the complete script or just parts of it Display run status (line number of currently executed function) GUI default always-on-top in the upper right corner for comfortable debugging WM_NOTIFY and WM_COMMAND hook to prevent interference with possible message handlers Display scope, type and value of variables, expressions, macro's and constants (global AND function local) Execute commands in an immediate window. Can be expressions, functions and assignments Detailed display of array, struct and object variables Dynamic display of variable value in the source code (under cursor) Array table viewer with ability to view the sub-arrays, the correct handling of macro @Error, @Extended and other changes OEM and ANSI console output Conditional breakpoints Saving settings and debugging state and much more... How to use
      Extract from downloaded archive _Dbug.au3 to your Autoit include dir Add #include <_Dbug.au3> in to your code and run code Before compile or buid comment or remove #include <_Dbug.au3> from your code
    • tiye0405
      By tiye0405
      Hello,
      global $y, $x #RequireAdmin Global $Paused HotKeySet("{NUMPAD2}", "Pause") HotKeySet("{NUMPAD8}", "End") Opt("MouseClickDownDelay", 30) #include <ImageSearch2015.au3> #include <ButtonConstants.au3> #include <ComboConstants.au3> #include <EditConstants.au3> #include <GUIConstantsEx.au3> #include <MsgBoxConstants.au3> #include <StaticConstants.au3> #include <WinAPI.au3> #include <WindowsConstants.au3> #include <UpDownConstants.au3> #include <Misc.au3> Sleep(6000) Sleep(3000) $search1 = _WaitForImageSearch("goo.bmp", 30, 1, $x, $y, 10) If $search1 = 1 Then MouseMove(1500, 1500, 10) Sleep(100) MouseClick("right") Sleep(300) EndIf I've this script.
      The problem is that it work the way it is supposed to but doesnt work on a friends pc, even tho we have the same image search in C/programms(x86)/autoit3/include 
      and the same dll in system 32.
      When he starts the script on the desktop without having the "goo.bmp" file on his pc, the script finds it and right clicks the given location, while for me it doesnt and i have to open the folder with the "goo.bmp" picture in it.

      Im out of ideas on what could cause the problem.
      Any help?
      Thank you in advance
       
       
    • xiantez
      By xiantez
      This script used to work on an older version of AutoIT. Currently I am running AutoIT v3.3.14.5 and it's failing.
      Func PublicIP() ;Post public facing IP address Local $url = 'https://www.google.com/search?client=opera&q=what+is+my+ip&sourceid=opera&ie=UTF-8&oe=UTF-8' Local $getIPaddress = BinaryToString(InetRead($url)) Local $sStart = 'clamp:2">' Local $sEnd = '</div>' Local $ipaddress = _StringBetween($getIPaddress, $sStart, $sEnd For $i In $ipaddress MsgBox(0, 'External IP', "Your public IP address is " & $i) Next EndFunc ;==>PublicIP The console output shows:
      "C:\Users\user\Documents\AutoIT\Scripts\WSI Tools.au3" (197) : ==> Variable must be of type "Object".: For $i In $ipaddress For $i In $ipaddress^ ERROR ->14:12:16 AutoIt3.exe ended.rc:1 +>14:12:16 AutoIt3Wrapper Finished. >Exit code: 1 Time: 9.811
    • Xandy
      By Xandy
      I'm listing the error message strings, and roughly matching the error code
      Is this how to do error reporting?  Is there a more simple way I don't know about?
      I realise I might not need to trap @error inside $error.  I like it this way b/c I have no fear of overwriting @error now; I don't even use it.
      Func Send_Connect($address, $port)     $socket = TCPConnect($address, $port)     $error = @error     If $error <> 0 Then         Local $aError[4] = ["-2 not connected.", _                             "1 IPAddr is incorrect.", _                             "2 port is incorrect."]         $aError[3] = "10060 Connection timed out."         If $error < 0 Then $error = 0         If $error > 2 Then $error = 3         MsgBox(0, "TCP Connect Error", $aError[$error], 0)         $socket = 0     EndIf     Return $socket EndFunc
×