Jump to content

Recommended Posts

Posted (edited)

I'm trying to convert a ahk script to autoit, but without luck,

#include <WinAPI.au3>

Local $module = _WinAPI_LoadLibrary("xd2txlib.dll")
ConsoleWrite($module & @LF)

Local $module = DllCall("Kernel32.dll", "Ptr", "LoadLibrary", "Str", "xd2txlib.dll")
ConsoleWrite($module[0] & @LF)

MsgBox(0, '_xdoc2txt()  Result:', _xdoc2txt(@ScriptDir & "\test.txt"))

Func _xdoc2txt($sFileName)
    Local $sfileText = ''
    Local $fileLength = DllCall("xd2txlib.dll", "int", 'ExtractText', "int", $sFileName, 'BOOL', True, 'int', $sfileText)

    MsgBox(0, '@error', @error)
    MsgBox(0, '', VarGetType($fileLength))
    MsgBox(0, '', $sfileText)
    Return $sfileText
EndFunc   ;==>_xdoc2txt

Here's the working ahk script:

myDoc := "test.txt"
ExtractText( content, myDoc )
MsgBox % content
ExtractText( ByRef OutputVar, Filename) 
{
    static hModule := DllCall( "LoadLibrary", "Str", "xd2txlib.dll", "Ptr")
    fileLength := DllCall( "xd2txlib\ExtractText", "Str", Filename, "Int", False, "Int*", fileText)
    OutputVar := StrGet( fileText, fileLength / 2 )
}

 

 

here's the ahk script https://www.autohotkey.com/boards/viewtopic.php?t=253

I have uploaded the dll, maybe someone can help?:)

xd2txlib.dll

Edited by legend

Share this post


Link to post
Share on other sites
9 hours ago, legend said:

DllCall("xd2txlib.dll", "int", 'ExtractText', "inst", $sFileName, 'BOOL', True, 'inst', $sfileText)

What kind of type is "inst"? :)


Click here to see my signature:

Spoiler

Thoughts:

  • I will always thank you for the time you spent for me.
    I'm here to ask, and from your response, I'd like to learn.
    By my knowledge, I can help someone else, and "that someone" could help in turn another, and so on.

/*--------------------------------------------------------------------------------------------------------------------------------------------------------------------------*/

ALWAYS GOOD TO READ:

 

Share this post


Link to post
Share on other sites
Posted (edited)
On 5/14/2019 at 7:25 AM, FrancescoDiMuro said:

What kind of type is "inst"? :)

should have been int* :)

any suggestions for getting it to work? =)

Edited by legend

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

×
×
  • Create New...