Shabang27 Posted March 21 Share Posted March 21 On one computer, the script works as intended. The second computer gives an error: "Failed loading DLLs.Failed loading DLLs." Func _cvLoadImage($filename, $iscolor = 1) If $filename = "" Then Return SetError(1) $_aResult = DllCall($_opencv_highgui, "int:cdecl", "cvLoadImage", "str", $filename, "int", $iscolor) MsgBox($MB_SYSTEMMODAL, "2", $_aResult) ; comment: our problem is $_aResult of this line^ it shows as 0 on the second computer (so its not an array) ; comment: while on the working computer it shows nothing which I assume is because an array won't show up on ; comment: MsgBox If @error Then ConsoleWrite("File not loading") If Not IsArray($_aResult) Then MsgBox(16, "Error", "Failed loading DLLs.Failed loading DLLs.") _OpenCV_Shutdown() Exit EndIf Return $_aResult[0] EndFunc ;==>_cvLoadImage My problem is $_aResult. It shows as 0 on the second computer (so it's not an array causing the error to flag) while on the first computer it shows nothing (which I assume is because an array won't show up on MsgBox) I tried compiling x64, x86, and copy pasting the folder with the script to the second computer and running from there, but there was no difference. I changed the resolution of both computers to be the same, no difference. OpenCV-Match_UDF.au3 Link to comment Share on other sites More sharing options...
Danp2 Posted March 21 Share Posted March 21 Have you verified that the DLL exists on the 2nd computer? What is the value of $_opencv_highgui on the problematic workstation? WebDriver UDF [GH&S] Latest version Wiki FAQs Link to comment Share on other sites More sharing options...
Shabang27 Posted March 21 Author Share Posted March 21 When I copied the whole folder to the second computer, the DLL was included in that. $_aResult = DllCall($_opencv_highgui, "int:cdecl", "cvLoadImage", "str", $filename, "int", $iscolor) the value of $_aResult in the problematic workstation is "0" Link to comment Share on other sites More sharing options...
Shabang27 Posted March 22 Author Share Posted March 22 My apologies, I misunderstood your question. the value of $_opencv_highgui is -1 on the problematic workstation. the value of $_opencv_highgui is 6 on the working workstation. Link to comment Share on other sites More sharing options...
Shabang27 Posted March 22 Author Share Posted March 22 $_opencv_highgui = DllOpen("..\DLLs\opencv_highgui2413.dll") This is what the code has for what $_opencv_highgui is Link to comment Share on other sites More sharing options...
Danp2 Posted March 22 Share Posted March 22 30 minutes ago, Shabang27 said: the value of $_opencv_highgui is -1 on the problematic workstation. This means the call to DllOpen failed. You will need to troubleshoot to find out why it's failing on this computer. WebDriver UDF [GH&S] Latest version Wiki FAQs Link to comment Share on other sites More sharing options...
mistersquirrle Posted March 22 Share Posted March 22 (edited) The biggest thing that I would recommend looking at first is, is one computer running 32-bit and the other 64-bit, and they're running the scripts at different platform levels? Also, is one running elevated and the other isn't? Beyond that, are there any dependencies that are required and missing (like dot net runtimes)? Python, or other Visual Studio related things maybe? Try running this on the two systems and show the output for each, mentioning which one is working and which isn't: #include <Array.au3> #include <Debug.au3> Global $aSysInfo[] = [@AutoItX64, @AutoItVersion, IsAdmin(), @CPUArch, @OSArch, @OSBuild, @OSType, @OSVersion] _ArrayTranspose($aSysInfo) _DebugArrayDisplay($aSysInfo, 'SysInfo', '', 0, Default, _ 'Script is 64-bit|AutoIt Version|IsAdmin|CPU Arch|OS Arch|OS Build|OS Type|OS Version') You should get a DebugArrayDisplay which you can copy the data from, or take a screenshot, but it should look something like: Row|Script is 64-bit|AutoIt Version|IsAdmin|CPU Arch|OS Arch|OS Build|OS Type |OS Version # 0|1 |3.3.16.1 |1 |X64 |X64 |19044 |WIN32_NT|WIN_10 As I mentioned, first things first, if the script is 32-bit on one and 64-bit on the other, that's the first thing to correct (using #AutoIt3Wrapper_UseX64=y or =n). Next up would be IsAdmin, which you can fix with #RequireAdmin. Outside of those, look into dependencies. Working on one and not on the other suggests its the environment, not the code (to me). Edited March 22 by mistersquirrle We ought not to misbehave, but we should look as though we could. Link to comment Share on other sites More sharing options...
Shabang27 Posted March 22 Author Share Posted March 22 @Danp2 Great suggestion, i'll look more into why the call to DllOpen is not working for $_opencv_highgui. @mistersquirrle I ran the debug code on both systems and here are the results of it: On the working system: Row|Script is 64-bit|AutoIt Version|IsAdmin|CPU Arch|OS Arch|OS Build|OS Type|OS Version Row 0|0|3.3.14.5|1|X64|X64|19043|WIN32_NT|WIN_10 On the problematic workstation: Row|Script is 64-bit|AutoIt Version|IsAdmin|CPU Arch|OS Arch|OS Build|OS Type|OS Version Row 0|0|3.3.14.5|1|X64|X64|19041|WIN32_NT|WIN_10 I also compile the script as .exe on the working system before running it on both systems, should that take care of the dependencies? Link to comment Share on other sites More sharing options...
Solution mistersquirrle Posted March 22 Solution Share Posted March 22 Are you sure that the DLL that you're opening is in the same location on both computers? Just compiling as EXE will take care of anything AutoIt related, so any #include files and all the AutoIt code/dependencies, but it will do nothing for any files that you're opening in the code, like your DLL. You can use FileInstall to include the DLL or other files into the EXE and that way you can carry them with the EXE. But, is the DLL available on both computers where the program is looking for it? And other dependencies I'm referencing are things that the DLL may rely on, such as Python or Visual Studio, which have nothing to do with AutoIt. We ought not to misbehave, but we should look as though we could. Link to comment Share on other sites More sharing options...
KaFu Posted March 22 Share Posted March 22 Did you install the whole OpenCV package on the 2nd computer, or did you only copy the dll? Might have a ton of dependencies, requiring a full package installation. OS: Win10-22H2 - 64bit - German, AutoIt Version: 3.3.16.1, AutoIt Editor: SciTE, Website: https://funk.eu AMT - Auto-Movie-Thumbnailer (2022-Nov-26) BIC - Batch-Image-Cropper (2023-Apr-01) COP - Color Picker (2009-May-21)HMW - Hide my Windows (2018-Sep-16) HRC - HotKey Resolution Changer (2012-May-16) ICU - Icon Configuration Utility (2018-Sep-16) SMF - Search my Files (2021-Oct-10) - THE file info and duplicates search tool SSD - Set Sound Device (2017-Sep-16) Link to comment Share on other sites More sharing options...
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