Artikash / Textractor

Extracts text from video games and visual novels. Highly extensible.
GNU General Public License v3.0
2.09k stars 203 forks source link

[Feature Request] log files #202

Closed FlyingWombat closed 5 years ago

FlyingWombat commented 5 years ago

What do you think about automatically saving hooked text to a log file?
It'd make for an easy way for other programs to get the hooked text.
One example would be using Firefox to view the log file, and Rikaichamp as a dictionary.

And, if possible, the option to set the location of the log would be good too.

Artikash commented 5 years ago

Something wrong with Ctrl-A in Textractor and copy and paste into notepad?

FlyingWombat commented 5 years ago

Well, no, copying into notepad works. I'm just lazy....
It'd probably be a pretty easy extension to make, but I'm not sure how to get started with making one.

Is there a way to compile extensions without visual studio, such as using Clang or Mingw? I'm running Windows in a VM, and it'd be a pain to have to install visual studio.

Artikash commented 5 years ago

You can compile extensions with other toolchains, but it'd probably be easier to just use this script with the Lua extension.

function ProcessSentence(sentence, sentenceInfo)
  if sentenceInfo["current select"] ~= 0 and sentenceInfo["text number"] ~= 0 then
    local file = io.open("log.txt", "a+")
    file:write(sentence, "\r\n")
    file:close()
  end
end
FlyingWombat commented 5 years ago

Thanks! Using Lua for little extensions is a great idea.

When I put that function into the little pop-up script editor (replacing the empty ProcessSentence function), and then get a new line of text in game, I get Lua error: ProcessSentence is not a function

P.S.
This is the first time I've used your program (or any text hooker). It's cool, and I'm thankful for the help with it. But, it could really use some documentation, especially about hooks and extensions.

Edit: hmm, I think I just needed to restart Textractor for the changed function to be loaded; I'm not getting that error anymore. So, it's working now. Thanks a bunch!

klesun commented 3 years ago

For future readers, to add this Lua script you need to go to Extensions -> (Right Mouse Click) -> Add extension -> Lua.xdll. A new window will appear then where you can paste the Lua script. I also had to restart the Textractor and press "Load script" to make it work.

In my case Lua.xdll was located in C:\Users\klesun\Desktop\Textractor\x86\Lua.xdll.

And the log.txt ended up appearing in the C:\Users\muramasa\Desktop\Textractor\x86\log.txt

P.S. thanks a lot for this awesome tool!