This is a static archive of our old Q&A Site. Please post any new questions and answers at ask.wireshark.org.

TextWindow.new() doesn’t work well?

0

Hi everybody I tried to show a window containing a message using TextWindow.new() but it always gave me a message that tshark stopped working when I run the file, the try is in a lua file that doesn't containing anything except TextWindow.new() and its method functions like append and so on, What's the problem? I did this because I wanted to try it alone before I merge it inside a big lua file. By the way my os is vista. Thanks a lot.

asked 16 Dec '12, 07:37

Leena's gravatar image

Leena
51171821
accept rate: 0%


One Answer:

1

What's the problem?

TextWindow.new and tshark? How would tshark open a new Window? That function is only usable within Wireshark. You can check for gui support with gui_enabled(), see the following example.

http://wiki.wireshark.org/Lua/Examples

Regards
Kurt

answered 16 Dec '12, 13:06

Kurt%20Knochner's gravatar image

Kurt Knochner ♦
24.8k1039237
accept rate: 15%

Is this(the message I got) what is meant by helloworld answers:

-- If not running from Wireshark, enable the tap immediately, then

-- abort, or else we'll get an error below for trying to do GUI

-- stuff from the command line.

in the question:http://ask.wireshark.org/questions/9682/trigger-an-executable-file-once-wireshark-finds-a-keyword-on-live-capture

?? Thanks.

(17 Dec '12, 23:43) Leena

In the answer of @helloworld you can see, that the code checks if the GUI is available. If no, it takes a different route.

if not gui_enabled() then make_tap(_filter) return end

So, you'll have to do similar things in your code. If the LUA script runs in tshark, you can't open a GUI window, as that is not possible.

(18 Dec '12, 00:40) Kurt Knochner ♦