[SOLVED] Call xd2txlib.dll failed on second time

Get help with using AutoHotkey (v1.1 and older) and its commands and hotkeys
tmplinshi
Posts: 1604
Joined: 01 Oct 2013, 14:57

[SOLVED] Call xd2txlib.dll failed on second time

13 Oct 2013, 02:44

Code: Select all

MsgBox, % xdoc2txt("d.doc")
MsgBox, % xdoc2txt("d.doc") ; <------- fail

xdoc2txt(fileName) {
	fileText   := 0
	fileLength := DllCall("xd2txlib\ExtractText", "Str", fileName, "Int", False, "Int", &fileText)
	Return, StrGet( NumGet(fileText), fileLength )
}
xd2txlib.dll is from xdoc2txt (Homepage | Forum post).
Download: xd2txlib test.7z | xdoc2txt 2.00 ( xd2tx200.zip )

Thanks.
Last edited by tmplinshi on 20 Jan 2014, 08:31, edited 3 times in total.
Guest10
Posts: 578
Joined: 01 Oct 2013, 02:50

Re: Call xd2txlib.dll failed on second time

13 Oct 2013, 08:08

is this due to a bug in xdoc2txt?
HotKeyIt
Posts: 2364
Joined: 29 Sep 2013, 18:35
Contact:

Re: Call xd2txlib.dll failed on second time

13 Oct 2013, 08:55

Try:

Code: Select all

MsgBox, % xdoc2txt("d.doc")
MsgBox, % xdoc2txt("d.doc") ; <------- fail

xdoc2txt(fileName) {
	fileLength := DllCall("xd2txlib\ExtractText", "Str", fileName, "Int", False, "Int*", fileText)
	Return, StrGet( fileText, fileLength )
}
tmplinshi
Posts: 1604
Joined: 01 Oct 2013, 14:57

Re: Call xd2txlib.dll failed on second time

13 Oct 2013, 09:36

HotKeyIt, it works! :D Thanks a lot!
"Int*" is cool.
tmplinshi
Posts: 1604
Joined: 01 Oct 2013, 14:57

Re: Call xd2txlib.dll failed on second time

19 Jan 2014, 17:10

I got a new problem...

Code: Select all

MsgBox, % xdoc2txt("1.xlsx", txt)

xdoc2txt(fileName) {
	fileLength := DllCall("xd2txlib\ExtractText", "Str", fileName, "Int", False, "Int*", fileText)
	; MsgBox, test ; Uncomment this line to avoid crash...
	Return, StrGet( fileText, fileLength )
}
If I didn't execute the MsgBox, script will crash. I've tried to replace the MsgBox to Sleep 5000, but still crash.

Download: https://www.dropbox.com/s/x0to0k3yr9jykpv/1.xlsx

(Tested on AHK 1.1.14.01 U32, Windows XP SP3)
HotKeyIt
Posts: 2364
Joined: 29 Sep 2013, 18:35
Contact:

Re: Call xd2txlib.dll failed on second time

20 Jan 2014, 05:05

That is surely due to unicode:

Code: Select all

MsgBox, % xdoc2txt("x:\1.xlsx")

xdoc2txt(fileName) {
    fileLength := DllCall("xd2txlib\ExtractText", "Str", fileName, "Int", False, "Int*", fileText)
    Return StrGet( fileText, fileLength / 2 )
}
tmplinshi
Posts: 1604
Joined: 01 Oct 2013, 14:57

Re: Call xd2txlib.dll failed on second time

20 Jan 2014, 08:29

Thanks for your help, HotkeyIt! It works!

Return to “Ask for Help (v1)”

Who is online

Users browsing this forum: Art1 and 111 guests