fehlermit imagesearch

  • Hi habe diesen code:

    Aber wenn ich in starte kommt dies meldung:
    >"C:\Program Files (x86)\AutoIt3\SciTE\..\autoit3.exe" /ErrorStdOut "C:\Users\heigi\Desktop\ffff.au3"
    C:\Program Files (x86)\AutoIt3\Include\ImageSearch.au3 (40) : ==> Subscript used with non-Array variable.:
    if $result[0]="0" then return 0
    if $result^ ERROR

    Im inlude ordner ist die imagesearch.au3
    und im system32 ordner ist die imagesearchdll.dll

  • Das ist mein ganzes script erstmal er soll nur nach dem bild auf dem desktop erstmal suchen und wenn er es gefunden hat soll einfach ne meldung kommen das er es gefunden hat^^


    mfg

  • willst du das er das bild solang sucht bis er es gefunden hat, oder nur einmal gucken obs da ist?

    Nur gucken obs da ist. Wenn er es gefunden hat eine message mir geben soll. Und wenn er es nicht gefunden hat soll er nach z.b 5sek wieder suchen.

    thx^^

  • Das kann nicht dein ganzes Script sein, weil:
    -nirgendwo ein Array ist und somit auch kein Fehler mit einem Array auftauchen kann
    - Der Fehler in Zeile 40 ist, dein gepostetes Script aber nur 15 Zeilen hat.

  • wo steht das? Hab gerade selber geschaut finnmde es aber nicht da ich es noch nie brauchte^^

  • Habe ich doch oder nicht? Habe sie von der Hauptseite runtergeladen. Da gib mir bitt einen Link damit ich nicht immer das falsche downloade^^
    Bei google kommt wenn ich auch nach der vollversion google nur mist raus.
    thx

  • Ich hab es mal angesehen und sihe da...
    Mir bringt er die fehler meldung

    Zitat

    >"G:\Programme\Auto It\AutoIt3\SciTE\..\autoit3.exe" /ErrorStdOut "C:\Users\*******\Desktop\Scripte\test\test1.au3"
    C:\Users\*******\Desktop\Scripte\test\test1.au3 (1) : ==> Error opening the file.:
    #include <ImageSearch.au3>

    >Exit code: 1 Time: 0.227


    Kann es vll sein das Du die #Include <ImageSearch.au3>
    Selbst Geschrieben hast und insInclude verzeichnus vonScite eingebaut hast??
    Den wen dies der fall sein sollte ist der fehler allerhöchstens in der ImageSearch.au3. Lad das File einfach mal hoch (Datei anhang) ind dan dürfte es zimlich sicher ne schnelle meldung geben ^^

    *Edit*
    Ach und, wzt benuzt heute noch Vista?
    Das kann man fast nicht alls Betriebssystem ansehen, und wen doch, dan ne sehr fühe beta Version von Win7 xD
    Sry, musste ich einfach Loswerden,is ned bösegemeint :D

    Mfg Skilkor

  • Man man leute viel drummherum um nix.

    Der ersteller der ImageSearch UDF hat geschlampt und eine Überprüfung in der UDF vergessen.
    Wenn der genannte Fehler auftaucht, dann ist entweder die Dll nicht vorhanden oder beschädigt.

    Ich gehe einfach mal davon aus, dass du die ImageSearchDLL gar nciht hast, deshalb lad dir die einfach mal runter und leg sie ins Scriptverzeichniss.

    Ab win Vista kann auch #RequireAdmin etwas bringen.


    EDIT:
    Wenn man die UDF so Modifiziert entsteht dieser error nicht und gibt stattdessen einfach -1 Zurück

    Spoiler anzeigen
    [autoit]

    #include-once
    ; ------------------------------------------------------------------------------
    ;
    ; AutoIt Version: 3.0
    ; Language: English
    ; Description: Functions that assist with Image Search
    ; Require that the ImageSearchDLL.dll be loadable
    ;
    ; ------------------------------------------------------------------------------

    [/autoit] [autoit][/autoit] [autoit][/autoit] [autoit]

    If not FileExists("ImageSearchDLL.dll") Then MsgBox(0,"","DLL nicht gefunden")
    ;===============================================================================
    ;
    ; 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
    ; Dll error - Returns -1
    ;
    ; Note: Use _ImageSearch to search the entire desktop, _ImageSearchArea to specify
    ; a desktop region to search
    ;
    ;===============================================================================
    Func _ImageSearch($findImage,$resultPosition,ByRef $x, ByRef $y,$tolerance, $HBMP=0)
    return _ImageSearchArea($findImage,$resultPosition,0,0,@DesktopWidth,@DesktopHeight,$x,$y,$tolerance,$HBMP)
    EndFunc

    [/autoit] [autoit][/autoit] [autoit]

    Func _ImageSearchArea($findImage,$resultPosition,$x1,$y1,$right,$bottom,ByRef $x, ByRef $y, $tolerance,$HBMP=0)
    ;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,"hwnd",$HBMP)

    [/autoit] [autoit][/autoit] [autoit]

    ; If error exit modified by Darter Autoit.de
    If IsArray($result) Then
    if $result[0]="0" then return 0
    Else
    Return -1
    EndIf

    ;Old exit
    ;if $result[0]="0" then return 0

    [/autoit] [autoit][/autoit] [autoit]

    ; 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],"|")

    [/autoit] [autoit][/autoit] [autoit]

    $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

    [/autoit] [autoit][/autoit] [autoit]

    ;===============================================================================
    ;
    ; Description: Wait for a specified number of seconds for an image to appear
    ;
    ; Syntax: _WaitForImageSearch, _WaitForImagesSearch
    ; Parameter(s):
    ; $waitSecs - seconds to try and find the image
    ; $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
    ;
    ;
    ;===============================================================================
    Func _WaitForImageSearch($findImage,$waitSecs,$resultPosition,ByRef $x, ByRef $y,$tolerance,$HBMP=0)
    $waitSecs = $waitSecs * 1000
    $startTime=TimerInit()
    While TimerDiff($startTime) < $waitSecs
    sleep(100)
    $result=_ImageSearch($findImage,$resultPosition,$x, $y,$tolerance,$HBMP)
    if $result > 0 Then
    return 1
    EndIf
    WEnd
    return 0
    EndFunc

    [/autoit] [autoit][/autoit] [autoit]

    ;===============================================================================
    ;
    ; Description: Wait for a specified number of seconds for any of a set of
    ; images to appear
    ;
    ; Syntax: _WaitForImagesSearch
    ; Parameter(s):
    ; $waitSecs - seconds to try and find the image
    ; $findImage - the ARRAY of images to locate on the desktop
    ; - ARRAY[0] is set to the number of images to loop through
    ; ARRAY[1] is the first image
    ; $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 the index of the successful find
    ; On Failure - Returns 0
    ;
    ;
    ;===============================================================================
    Func _WaitForImagesSearch($findImage,$waitSecs,$resultPosition,ByRef $x, ByRef $y,$tolerance,$HBMP=0)
    $waitSecs = $waitSecs * 1000
    $startTime=TimerInit()
    While TimerDiff($startTime) < $waitSecs
    for $i = 1 to $findImage[0]
    sleep(100)
    $result=_ImageSearch($findImage[$i],$resultPosition,$x, $y,$tolerance,$HBMP)
    if $result > 0 Then
    return $i
    EndIf
    Next
    WEnd
    return 0
    EndFunc

    [/autoit]

    mfg Darter

    Das finden von Rechtschreibfehlern muss sofort und unverzüglich dem Autor gemeldet werden. Das eigennützige Verwenden dieser Rechtschreibfehler ist strengstens untersagt und kann mit Freiheitsenzug bestraft werden.

    Einmal editiert, zuletzt von Darter (28. Juli 2010 um 07:35)