Jump to content
Sign in to follow this  
Chika95

OpenPlugin() errors

Recommended Posts

Chika95

Here is my code:

$InstalledHashFileLocation = @ScriptDir & "\MD5Hash.dll"
    
    If FileExists($InstalledHashFileLocation) = 0 Then
        msgbox(0x40000,"Error","Error code is: 3.  Contact support, exiting...")
        Exit
    EndIf
    
    $plH = PluginOpen($InstalledHashFileLocation)
    
    IF $plH = 0 then
        msgbox(0x40000,"Error","Error code is: 2.  Contact support, exiting...")
        Exit
    EndIf
    
    $Str = 123456789
    
    $ret = MD5Hash($Str, 2, True)

You can get Md5Hash.dll from: http://www.autoitscript.com/forum/index.ph...&hl=Md5Hash

I'm getting an error returning the plugin handle. If I take out the check to seeif PlH = 0 then I get an unknown function on the Md5Hash()

Edited by BotXpert

Share this post


Link to post
Share on other sites
Chika95

/bump

Also, how come there is no documentation on Pluginopen or PluginClose, or the like? Theere is html documentation online, but its very limited, is this going to be included in the next help file?

Edited by BotXpert

Share this post


Link to post
Share on other sites
Zedna

/bump

Also, how come there is no documentation on Pluginopen or PluginClose, or the like? Theere is html documentation online, but its very limited, is this going to be included in the next help file?

Implementing plugins architecture in FULL/FINAL way is not finished yet.

So take it as BETA stadium only.

Jon said he wants to implement #include plugins architecture in the future

so you will write something like

#include "MD5Hash.dll"

instead of

PluginOpen("MD5Hash.dll")

Share this post


Link to post
Share on other sites
Chika95

The weird thing is,"PluginOpen("MD5Hash.dll")" was working a few days ago. Then suddenly its not. I'm not sure if anyone else if having trouble

Share this post


Link to post
Share on other sites
encode

The weird thing is,"PluginOpen("MD5Hash.dll")" was working a few days ago. Then suddenly its not. I'm not sure if anyone else if having trouble

The same thing is happening for me. It works fine on a computer with an old version of AutoIT installed, but on a computer with 3.2.11.2 installed, I get "unknown function name" by running the code in SciTE, and the following check tells me the dll is not loaded:

$a = DllCall('Kernel32.dll','hwnd','GetModuleHandle', 'str','MD5Hash.dll')
If not $a[0] Then MsgBox(0,'Error','Plugin not loaded')

Share this post


Link to post
Share on other sites
ChrisL

This is a script I have which uses the MD5Hash plugin, I've just ran it up on 3.2.12 and it works fine. Does this work for you?

#AutoIt3Wrapper_plugin_funcs = MD5Hash

If Not FileExists("MD5Hash.dll") then FileInstall("MD5Hash.dll",@scriptdir & "\MD5Hash.dll")
$plH = PluginOpen("MD5Hash.dll")

$ans = Msgbox(1,"Create MD5","Select file to generate MD5 hash")
If $ans <> 1 then Exit
$file = FileOpenDialog("MD5",@scriptDir,"(*.exe)",1)
If NOT @error then 
$md5 = MD5Hash($file, 1, True)
ClipPut($md5)
MsgBox(0, "MD5Hash","MD5Hash: " &  $md5 & @crlf & "Has been placed on the clipboard")

EndIf

Func OnAutoitExit()
    PluginClose($plH)
Endfunc

Share this post


Link to post
Share on other sites
ChrisL

This works

#AutoIt3Wrapper_plugin_funcs = MD5Hash

$InstalledHashFileLocation = @ScriptDir & "\MD5Hash.dll"
    
    If FileExists($InstalledHashFileLocation) = 0 Then
        msgbox(0x40000,"Error","Error code is: 3.  Contact support, exiting...")
        Exit
    EndIf
    
    $plH = PluginOpen($InstalledHashFileLocation)
    
    IF @error then;<<<<<<<<<<<<<<<<<<<<<Changed this line
        msgbox(0x40000,"Error","Error code is: 2.  Contact support, exiting...")
        Exit
    EndIf
    
    $Str = String(123456789);<<<<<<<<<<<<<<<<<<<<<Changed this line it was a number not a string! You could also have done this $Str = "123456789"
    
    $ret = MD5Hash($Str, 2, True)
    
    Msgbox(0,"",$ret)

Share this post


Link to post
Share on other sites
ChrisL

Just done some more checking

$plH = PluginOpen($InstalledHashFileLocation)
    
    IF @error then;<<<<<<<<<<<<<<<<<<<<<Changed this line
        msgbox(0x40000,"Error","Error code is: 2.  Contact support, exiting...")
        Exit
    EndIf

PluginOpen() never seems to error even if the dll doesn't exist so even if it failed to open you'd never get an @error and $plH always returns 0 so your knackered on the error checking

Share this post


Link to post
Share on other sites
ProgAndy

To check if a file exists in DLL-Search-Path, use:

if you have a full path, just use FileExists :)

CODE
MsgBox(0, 'filenoexist.dll',"filenoexist.dll exists: " & _CheckPathFile("filenoexist.dll"))

MsgBox(0, 'msvideo.dll',"msvideo.dll exists: " & _CheckPathFile("msvideo.dll"))

;===============================================================================

;

; Function Name: _CheckPathFile($file)

; Description:: Checks if a file exists in DLL-searchpatch

; Parameter(s): $file - DLL-FileTo look for

; Requirement(s): AutoIT

; Return Value(s): Success: 1, Error: 0

; Author(s): Prog@ndy

;

; More information: http://msdn.microsoft.com/en-us/library/7d83bc18(VS.80).aspx

;

;===============================================================================

;

Func _CheckPathFile($file)

If FileExists(@ScriptDir& "\" & $file) Or FileExists($file) Or FileExists(@SystemDir& "\" & $file) Or FileExists(@WindowsDir& "\" & $file) Then Return 1

Local $PATH = EnvGet("PATH")

Local $PATHArr = StringSplit($PATH,";")

Local $i

For $i = 1 To $PATHArr[0]

If FileExists($PATHArr[$i] & "\" & $File) Then Return 1

Next

Return 0

EndFunc


*GERMAN* [note: you are not allowed to remove author / modified info from my UDFs]My UDFs:[_SetImageBinaryToCtrl] [_TaskDialog] [AutoItObject] [Animated GIF (GDI+)] [ClipPut for Image] [FreeImage] [GDI32 UDFs] [GDIPlus Progressbar] [Hotkey-Selector] [Multiline Inputbox] [MySQL without ODBC] [RichEdit UDFs] [SpeechAPI Example] [WinHTTP]UDFs included in AutoIt: FTP_Ex (as FTPEx), _WinAPI_SetLayeredWindowAttributes

Share this post


Link to post
Share on other sites

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
Sign in to follow this  

×

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.