ImageSearch [x- und y-Koordinaten in ein Array] --> ERROR

  • Hey zusammen

    ich habe folgendes Problem:

    Code
    : ==> Error parsing function call.:
    $result0 = _ImageSearch($sPath & "test.png", 1, $x[0], $y[0], 130)
    $result0 = _ImageSearch($sPath & "test.png", 1, $x^ ERROR

    Warum spuckt er mir dort ein Fehler aus, liegt es am $x Array?

  • Kann man nix zu sagen _ImageSearch ist keinen Standardfunktion von Autoit.

    Andy hat mir ein Schnitzel gebacken aber da war ein Raupi drauf und bevor Oscar das Bugfixen konnte kam Alina und gab mir ein AspirinJunkie.

  • Warst schneller als mein edit hehe. Wie gesagt ist _ImageSearch keine Standardfunktion von daher keine Ahnung was für Paramater da erwartet werden.

    Andy hat mir ein Schnitzel gebacken aber da war ein Raupi drauf und bevor Oscar das Bugfixen konnte kam Alina und gab mir ein AspirinJunkie.

  • Dort einmal die gekürzte Imegsearch.au3 :)
    Vllt. kannst du mir danach weiterhelfen


    Sobald ich $x nicht als Array sondern einzelnt als $x1 schreibe klappts... Naja von daher denke ich mal das in ImageSearch das Array einfach nicht genommen werden kann.

    Einmal editiert, zuletzt von Bloody JuJu (8. Mai 2012 um 23:28)

  • Spoiler anzeigen
    [autoit]

    Global $x[17], $y[17]
    Global $sPath = @DesktopDir &"\"

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

    $result0 = _ImageSearch($sPath & "test.png", 1, $x[0], $y[0], 130)
    MsgBox (0, "", $result0)

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

    Func _ImageSearch($findImage,$resultPosition,ByRef $x, ByRef $y,$tolerance)
    return _ImageSearchArea($findImage,$resultPosition,0,0,@DesktopWidth,@DesktopHeight,$x,$y,$tolerance)
    EndFunc

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

    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)

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

    ; If error 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]

    Der Code da oben funktioniert bei mir wunderbar. Dein Fehler muss irgendwo anders begraben sein.

  • Selbst bei deinem Script kriege ich folgenden Fehler:

    Code
    test.au3 (17) : ==> Subscript used with non-Array variable.:
    if $result[0]="0" then return 0
    if $result^ ERROR

    Habs probiert mit einer Deklaration zu lösen: GLobal $result[1] , aber selbst das bringt nichts. Selber Fehler... hm

    Einmal editiert, zuletzt von Bloody JuJu (9. Mai 2012 um 18:02)

  • Das ist aber ein ganz anderer Fehler... :P
    Führe das Script mal in Scite mit F5 aus, oder aus dem Ordner mit einem Rechtsklick -> Run Script (x86).

  • Imagesearchdll.dll im Verzeichnis?

  • Führe meine Scripts immet via F5 aus und ImagesearchsearchDLL ist im System32 ordner ;)

  • Auch dort befindet sich die DLL. Hab sie auch nochmal ersetzt, trotzdem kein Glück.

    EDIT: Fehelr behoben:

    Zitat

    #AutoIt3Wrapper_UseX64=n

    Nun noch der andere Fehler, den ich oben beschrieben habe beheben^^

    Ein auschnitt vom Script nochmal:

    Code
    Func TEST()
    	Do
    		$result0 = _ImageSearch($sPath & "Test.png", 1, $x[0], $y[0], 130)
    	Until $result0 = 1
    
    
    	MouseMove($x[0], $y[0], 1)
    	Sleep("100")
    EndFunc

    Diese wird mittels Hotkey aufgerufen, hmmm