dwaynek Posted May 19, 2009 Posted May 19, 2009 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?
Authenticity Posted May 19, 2009 Posted May 19, 2009 Do you have the dll on your Vista machine? ...and whether the dll file is either in the ImageSearch.au3 directory or in the System32 folder?
dwaynek Posted May 19, 2009 Author Posted May 19, 2009 yes the dll is in my c:\windows\system32 and it doesn't work.
Authenticity Posted May 19, 2009 Posted May 19, 2009 What is the value of the @error macro when you try to open the dll or call one of it's function?
Authenticity Posted May 20, 2009 Posted May 20, 2009 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.
dwaynek Posted May 21, 2009 Author Posted May 21, 2009 i got: >"C:\Program Files (x86)\AutoIt3\SciTE\..\autoit3.exe" /ErrorStdOut "H:\My Documents\bat\test.au3" @error: 0 $hDll: -1 1 $result is not an array type >Exit code: 0 Time: 0.205
Authenticity Posted May 21, 2009 Posted May 21, 2009 (edited) 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 May 21, 2009 by Authenticity
dwaynek Posted May 22, 2009 Author Posted May 22, 2009 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.
hxhjx Posted November 29, 2009 Posted November 29, 2009 (edited) 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: 100001280800download.bmp>Exit code: 0 Time: 5.547your 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.626when using the normal script:C:\Users\Sascha\Desktop\Pandorum\pandorum.au3 (24) : ==> Variable used without being declared.:if $result=1 Thenif ^ ERROR>Exit code: 1 Time: 5.519i hope you can help me too (windows 7 , 32bit)regards hxhjx Edited November 29, 2009 by hxhjx
zapperzme Posted December 11, 2009 Posted December 11, 2009 (edited) I really hope this post is still alive.. I also stumbled upon this setback .. tried your code, the result : @error: 0 $hDll: -1 1 >Exit code: 0 Time: 1.124 Using Win7 64bit Edited December 11, 2009 by zapperzme
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now