Jump to content

how do i get ImageSearch.au3 to work under Vista x64?


Recommended Posts

my script worked fine in xp 32-bit but fails in Vista x64 with this error:

Line 40 ...ImageSearch.au3

if $result[0]="0" then return 0

if $result^ ERROR

Error: Subscript used with non-Array variable

anyone know a solution?

Link to comment
Share on other sites

Hi, can you try a little test and post the results?

$hDll = DllOpen('ImageSearchDLL.dll')
ConsoleWrite('@error: ' & @error & @TAB & '$hDll: ' & $hDll & @LF)

; Replace the last parameter to the real path and image file name.
$result = DllCall("ImageSearchDLL.dll", "str", "ImageSearch", "int", _
                0, "int", 0, "int", @DesktopWidth, "int", @DesktopHeight, "str", 'C:\path\Image.bmp')
ConsoleWrite(@error & @LF)
If IsArray($result) Then
    For $i = 0 To 5
        ConsoleWrite($result[$i] & @LF)
    Next
Else
    ConsoleWrite('$result is not an array type' & @LF)
EndIf

If $hDll <> -1 Then DllClose($hDll)

Replace the path in the last parameter.

Link to comment
Share on other sites

Yes, it seems like it can't open the dll but you said you do have the dll on the Vista machine. Try to copy/move the dll file to the script directory, same with the ImageSearch.au3 so both, the dll and ImageSearch.au3 files are in the script directory. Rerun the test again and see if you get $hdll = -1 or "$result is not an array type".

Edit: Additionally, can you try to open the dll like this and see what is the returned value:

#include <WinAPI.au3>

Global Const $DONT_RESOLVE_DLL_REFERENCES = 0x00000001
Global $hDll

$hDll = _WinAPI_LoadLibraryEx('ImageSearchDLL.dll', $DONT_RESOLVE_DLL_REFERENCES)
ConsoleWrite($hDll & @LF)
Edited by Authenticity
Link to comment
Share on other sites

HOLLLYYYCRAPPP!!! you r a freakin genius!!!! i copyied the dll file to C:\Program Files (x86)\AutoIt3 & ran the last code:

>"C:\Program Files (x86)\AutoIt3\SciTE\..\autoit3.exe" /ErrorStdOut "H:\My Documents\bat\test.au3"

0x10000000

>Exit code: 0 Time: 0.415

then running prior to last code:

>"C:\Program Files (x86)\AutoIt3\SciTE\..\autoit3.exe" /ErrorStdOut "H:\My Documents\bat\test.au3"

@error: 0 $hDll: 1

0

0

0

0

1280

1024

h:\my documents\ymailnewbutton.bmp

>Exit code: 0 Time: 0.319

then ran my script and it worked!!! very kewl!!! thanks a lot! im sure lots of vista owners will want to know this workaround.

Link to comment
Share on other sites

  • 6 months later...

hi,

i know this is a old post but i still have this problem. when i use your function i got that output:

>"C:\Program Files\AutoIt3\SciTE\..\autoit3.exe" /ErrorStdOut "C:\Users\Sascha\Desktop\Pandorum\dlltest.au3"

@error: 0 $hDll: 1

0

0

0

0

1280

800

download.bmp

>Exit code: 0 Time: 5.547

your second code produce this:

>"C:\Program Files\AutoIt3\SciTE\..\autoit3.exe" /ErrorStdOut "C:\Users\Sascha\Desktop\Pandorum\dlltest.au3"

0x02B30000

>Exit code: 0 Time: 0.626

when using the normal script:

C:\Users\Sascha\Desktop\Pandorum\pandorum.au3 (24) : ==> Variable used without being declared.:

if $result=1 Then

if ^ ERROR

>Exit code: 1 Time: 5.519

i hope you can help me too (windows 7 , 32bit)

regards hxhjx

Edited by hxhjx
Link to comment
Share on other sites

  • 2 weeks later...

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
 Share

  • Recently Browsing   0 members

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