0
votes

I have an app written in Lua with wxLua. While this app is running, I want to be able to send a (large) string to an external program so the user can view the string, search it, etc.

This external program can be notepad, notepad++, etc, or even a browser window, as long as the user can view and search the text.

I can open open an editor using

local handle = io.popen("notepad", "w") -- for example

but then

handle:write (myString)

doesn't show anything in the editor. And notepad++ doesn't even open a new window if I already have it running.

I can launch a browser using

wx.wxLaunchDefaultBrowser ("http://stackoverflow.com")

but I don't know how to pass the (100-200kb) string to the browser window.

Any help is very much appreciated, thank you! Stomp

2

2 Answers

3
votes

Print out text or HTML file and then open it in browser with wx.wxLaunchDefaultBrowser ("file://path/to/file") or use os.execute to run external editor with same file as argument.

2
votes

See Oleg's post for the best solution, IMO.

Another solution would be to place your text on the clipboard, so the user could paste it wherever they like.

As for injecting text into apps that are already open, that's non-trivial and beyond the scope of what you can do with wxLua. You'd need to use COM interfaces or traverse the apps' control structures using Win32 API calls or something equally hairy and often app-specific.