Jump to content

Recommended Posts

Posted (edited)

i get a wierd problam wani try use it

this is the code i use to summon the func

it need to wait until the image apper or stop wan i preass a button

Do 
                sleep(5000)
                $oka = _ImageSearchArea(@ScriptDir &"\image\sroOn.BMP",1,38,95,186,122,$x1,$y1,0)
            Until $oka = 1 or GUIGetMsg() = $Stop

this is the error

C:\Program Files\AutoIt3\Include\ImageSearch.au3 (40) : ==> Subscript used with non-Array variable.:
if $result[0]="0" then return 0
if $result^ ERROR

i attach the imagesearch i DL to this topic

pls help

ImageSearch.zip

Edited by yakir
Posted

It is saying that $result is not an array. The issue resides in ImageSearch.au3 as indicated by the compiler.

$result = DllCall("ImageSearchDLL.dll", "str", "ImageSearch", "int", $x1, "int", $y1, "int", $right, "int", $bottom, "str", $findImage)

    ; If error exita
    If $result[0] = "0" Then Return 0

You say that the DLLCall should return a string, find out what it is really returning using ConsoleWrite. You can also use the function IsArray to assert an array is returned.

Post your code because code says more then your words can. SciTe Debug mode - it's magic: #AutoIt3Wrapper_run_debug_mode=Y. Use Opt("MustDeclareVars", 1)[topic="84960"]Brett F's Learning To Script with AutoIt V3[/topic][topic="21048"]Valuater's AutoIt 1-2-3, Class... is now in Session[/topic]Contribution: [topic="87994"]Get SVN Rev Number[/topic], [topic="93527"]Control Handle under mouse[/topic], [topic="91966"]A Presentation using AutoIt[/topic], [topic="112756"]Log ConsoleWrite output in Scite[/topic]

Posted

i read about DLLcall in the help files

DllCall ( "dll", "return type", "function" [, type1, param1 [, type n, param n]] )

"return type"

this give you the the string type so it is give me string so what is it's problam?

Posted

As I said, you think the dll should return a string. What I am saying is "Subscript used with non-Array variable." means that AutoIt does not see '$result' as an array or string when you are using subscript. (A string is an character array).

In your error checking if the string returned is blank or invalid then $result[0] = "0" will fail. I would do the following.

If Not IsString($result) Then Return 0
If $result = "" Then Return 0
ConsoleWrite($result & @CRLF)

Post your code because code says more then your words can. SciTe Debug mode - it's magic: #AutoIt3Wrapper_run_debug_mode=Y. Use Opt("MustDeclareVars", 1)[topic="84960"]Brett F's Learning To Script with AutoIt V3[/topic][topic="21048"]Valuater's AutoIt 1-2-3, Class... is now in Session[/topic]Contribution: [topic="87994"]Get SVN Rev Number[/topic], [topic="93527"]Control Handle under mouse[/topic], [topic="91966"]A Presentation using AutoIt[/topic], [topic="112756"]Log ConsoleWrite output in Scite[/topic]

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...