Register for your free account! | Forgot your password?

Go Back   elitepvpers > Coders Den > AutoIt
You last visited: Today at 04:15

  • Please register to post and access all features, it's quick, easy and FREE!

Advertisement



imagesearcharea

Discussion on imagesearcharea within the AutoIt forum part of the Coders Den category.

Reply
 
Old   #1
 
elite*gold: 0
Join Date: Jun 2010
Posts: 65
Received Thanks: 0
imagesearcharea

Hey Leute, hab leider weder im Internet noch in der Datei imagesearch.au3 was zu Parameterliste von _imagesearcharea gefunden, daher nun meine Frage:

Fall 1:
Code:
#include <ImageSearch.au3> 

$aFenster = WinGetPos ("Windows Media Player")
Local $result_x, $result_y

If _ImageSearchArea(@ScriptDir & "/Data/2.bmp", 0, $aFenster[0], $aFenster[1], $aFenster[0]+$aFenster[2], $aFenster[1]+$aFenster[3], $result_x, $result_y, 50) == 1 Then
   MsgBox("", "Erfolg", "Erfolg")
EndIf
Fall 2:
Code:
#include <ImageSearch.au3> 

$aFenster = WinGetPos ("Windows Media Player")
Local $result_x, $result_y

If _ImageSearchArea(@ScriptDir & "/Data/2.bmp", 0, $aFenster[0], $aFenster[1], $aFenster[2], $aFenster[3], $result_x, $result_y, 30) == 1 Then
   MsgBox("", "Erfolg", "Erfolg")
EndIf
Mit welchem durchsuche ich nur das Fenster (Win Media Player)?
Gruß derrod

EDIT: Fall 1 ist richtig, der 5. und 6. Parameter sind die Koordinaten des Punkts rechts unten!!! der Grund dafür, dass beides nicht funktioniert, ist jener, dass WinGetPos bei Windows Media Player leider falsche Werte zurückgibt (keine Ahnung wieso).
derrod is offline  
Old 07/27/2014, 23:33   #2
 
MrDami123's Avatar
 
elite*gold: 56
Join Date: Oct 2010
Posts: 3,409
Received Thanks: 1,219
Wieso öffnest du nicht einfach das Script und schaust nach?
MrDami123 is offline  
Old 07/27/2014, 23:39   #3
 
elite*gold: 0
Join Date: Jun 2010
Posts: 65
Received Thanks: 0
nun das hab ich, leider funzt beides nicht daher die Frage welchen Ansatz ich verfolgen soll!

Das komische ist, dass _imageSearch (also über den ganzen Bildschirm) funktioniert...
derrod is offline  
Old 07/27/2014, 23:42   #4
 
MrDami123's Avatar
 
elite*gold: 56
Join Date: Oct 2010
Posts: 3,409
Received Thanks: 1,219
Quote:
Originally Posted by derrod View Post
hab leider weder im Internet noch in der Datei imagesearch.au3 was zu Parameterliste von _imagesearcharea gefunden
Code:
Func _ImageSearchArea($findImage,$resultPosition,$x1,$y1,$right,$bottom,ByRef $x, ByRef $y, $tolerance)
    ;MsgBox(0,"asd","" & $x1 & " " & $y1 & " " & $right & " " & $bottom)
    if $tolerance>0 then $findImage = "*" & $tolerance & " " & $findImage
    $result = DllCall("ImageSearchDLL.dll","str","ImageSearch","int",$x1,"int",$y1,"int",$right,"int",$bottom,"str",$findImage)

    ; If error exit
    if $result[0]="0" then return 0
    
    ; Otherwise get the x,y location of the match and the size of the image to
    ; compute the centre of search
    $array = StringSplit($result[0],"|")
   
   $x=Int(Number($array[2]))
   $y=Int(Number($array[3]))
   if $resultPosition=1 then
      $x=$x + Int(Number($array[4])/2)
      $y=$y + Int(Number($array[5])/2)
   endif
   return 1
EndFunc
Quelle:

Zusatz:
Quote:
;================================================= ==============================
;
; Description: Find the position of an image on the desktop
; Syntax: _ImageSearchArea, _ImageSearch
; 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
;
; Return Value(s): On Success - Returns 1
; On Failure - Returns 0
;
; Note: Use _ImageSearch to search the entire desktop, _ImageSearchArea to specify
; a desktop region to search
;
;================================================= ==============================
MrDami123 is offline  
Old 07/27/2014, 23:50   #5
 
elite*gold: 0
Join Date: Jun 2010
Posts: 65
Received Thanks: 0
danke meister, aber da war ich auch schon! leider wird keine Aussage über die parameter von _imagesearcharea gemacht sondern nur über _imagsearch!

und $right und $bottom kann beides bedeuten!
derrod is offline  
Old 07/28/2014, 00:02   #6
 
MrDami123's Avatar
 
elite*gold: 56
Join Date: Oct 2010
Posts: 3,409
Received Thanks: 1,219
Da steht doch das die Syntax für beide ist. Abgesehen davon verwendet _ImageSearch _ImageSearchArea mit eigenen Parametern, aus denen man die Bedeutung, zumindest von diesen, auch ableiten kann.

Code:
; Syntax:           _ImageSearchArea, _ImageSearch
; 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
;
; Return Value(s):  On Success - Returns 1
;                   On Failure - Returns 0
Code:
Func _ImageSearch($findImage,$resultPosition,ByRef $x, ByRef $y,$tolerance)
   return _ImageSearchArea($findImage,$resultPosition,0,0,@DesktopWidth,@DesktopHeight,$x,$y,$tolerance)
EndFunc
Code:
Func _ImageSearchArea($findImage,$resultPosition,$x1,$y1,$right,$bottom,ByRef $x, ByRef $y, $tolerance)
Somit steht $x1,$y1 für die Startposition. $right,$bottom für die Desktop Auslösung. Der Rest steht oben in der Beschreibung.

Da ich kein AutoIT kann und es auch nicht drauf hab zum testen, musst du wohl den Code einfach anpassen.
MrDami123 is offline  
Old 07/28/2014, 00:05   #7
 
elite*gold: 0
Join Date: Jun 2010
Posts: 65
Received Thanks: 0
Quote:
Originally Posted by MrDami123 View Post
Somit steht $x1,$y1 für die Startposition. $right,$bottom für die Desktop Auslösung. Der Rest steht oben in der Beschreibung.
Nein, $right und $bottom steht nicht für die Auflösung, sondern entweder für den unteren Eckpunkt oder die Breite und Höhe des Kastens in dem gesucht werden soll... und das ist meine Frage: Punkt oder Breite/Höhe
derrod is offline  
Old 07/28/2014, 01:09   #8
 
MrDami123's Avatar
 
elite*gold: 56
Join Date: Oct 2010
Posts: 3,409
Received Thanks: 1,219
Wenn _ImageSearch es als ,@DesktopWidth,@DesktopHeight verwendet, steht es wohl für die Bildbreite und Höhe.

Etwas lesen und mitdenken kannst du doch auch.
MrDami123 is offline  
Old 07/28/2014, 09:02   #9
 
elite*gold: 0
Join Date: Jun 2010
Posts: 65
Received Thanks: 0
welche koordinaten hat denn die rechte untere Ecke des Bildschirms? Antwort: (desktopbreite; desktophöhe)
also kann es beides sein, die breite und höhe des kastens oder die koordinaten der rechten unteren ecke!

sorry, aber vielleicht wärs sinvoll wenn du dir nochmal genau meine Frage durchliest, weil du mir jetzt schon zum dritten mal Informationen lieferst, die ich schon kannte und die die Antwort offen lassen!
derrod is offline  
Old 07/28/2014, 17:20   #10
 
flumio's Avatar
 
elite*gold: 50
Join Date: Feb 2009
Posts: 765
Received Thanks: 927
Speicher dir doch einfach per wingetpos die koords vom benötigten fenster und benütze diese um das area für ImageSearchArea zu erhalten. Dann ist es nämlich auch egal wo und wie groß das Fenster bei irgendwem ist.
flumio is offline  
Thanks
1 User
Old 07/28/2014, 21:23   #11
 
elite*gold: 0
Join Date: Jun 2010
Posts: 65
Received Thanks: 0
aber genau das tue ich doch im codeausschnitt! liest sich hier überhaupt jemand die frage durch?
derrod is offline  
Old 07/29/2014, 05:36   #12
 
flumio's Avatar
 
elite*gold: 50
Join Date: Feb 2009
Posts: 765
Received Thanks: 927
Hmm tut mir leid hab bisher die Beiträge nur überflogen.
Keiner der beiden Codes kann funktionieren.

Quote:
;================================================= ==============================
;
; Description: Find the position of an image on the desktop
; Syntax: _ImageSearchArea, _ImageSearch
; 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
;
; Return Value(s): On Success - Returns 1
; On Failure - Returns 0
;
; Note: Use _ImageSearch to search the entire desktop, _ImageSearchArea to specify
; a desktop region to search
;
;================================================= ==============================
_ImageSearchArea($findImage,$resultPosition,$x1,$y 1,$right,$bottom,ByRef $x, ByRef $y, $tolerance)

Dein Fehler ist hier:
Quote:
_ImageSearchArea(@ScriptDir & "/Data/2.bmp", 0, $aFenster[0], $aFenster[1], $aFenster[2], $aFenster[3], $result_x, $result_y, 30) == 1 Then
So nun weist du wo dein Fehler ist und hast auch die Hilfe den zu beheben. Jede andere Hilfe wäre nur Copy/Paste und hätte kein Lerneffekt.
flumio is offline  
Thanks
1 User
Old 07/29/2014, 06:41   #13
 
elite*gold: 0
Join Date: Jun 2010
Posts: 65
Received Thanks: 0
danke, ich will aber garkeinen code, sondern nur die einfache info, wofür die parameter $right und $bottom stehen, ob für die breite und höhe des kastens oder für die koordinaten der unteren rechten ecke!
derrod is offline  
Old 07/29/2014, 13:00   #14
 
flumio's Avatar
 
elite*gold: 50
Join Date: Feb 2009
Posts: 765
Received Thanks: 927
Stell dir vor du erstellst einen Bereich (Rechteck) mit 2 Punkten, der erste Punkt ist oben Links - x1, y1 und der zweite Punkt unten rechts - right, bottom

Steht aber auch in der ImageSearch.au3 bei den Infos.
flumio is offline  
Thanks
1 User
Old 07/29/2014, 13:54   #15
 
elite*gold: 0
Join Date: Jun 2010
Posts: 65
Received Thanks: 0
Aha, also der Punkt, VIELEN DANK
aber wieso geht dann der erste Fall nicht? da nehm ich doch den punkt:

Quote:
Originally Posted by derrod View Post
Fall 1:
Code:
#include <ImageSearch.au3> 

$aFenster = WinGetPos ("Windows Media Player")
Local $result_x, $result_y

If _ImageSearchArea(@ScriptDir & "/Data/2.bmp", 0, $aFenster[0], $aFenster[1], $aFenster[0]+$aFenster[2], $aFenster[1]+$aFenster[3], $result_x, $result_y, 50) == 1 Then
   MsgBox("", "Erfolg", "Erfolg")
EndIf
derrod is offline  
Reply


Similar Threads Similar Threads
ImageSearchArea
08/08/2013 - AutoIt - 7 Replies
Alright im trying to search a certain area And cant seem to wrap my head around the code. _ImageSearchArea("$vcl.bmp",$resultPosi tion,$x1,$y1,$right,$bottom,ByRef $x, ByRef $y, $tolerance) The place im trying to search is: - Top Left corner : 298,211 - Bottom Right corner: 507, 279



All times are GMT +1. The time now is 04:15.


Powered by vBulletin®
Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
SEO by vBSEO ©2011, Crawlability, Inc.
This site is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply.

Support | Contact Us | FAQ | Advertising | Privacy Policy | Terms of Service | Abuse
Copyright ©2025 elitepvpers All Rights Reserved.