Dcode
Dcode

Reputation: 223

How to get back wish shell after console hide

I have a tcl wish shell as Tcl interpreter, where I executed console hide command. So console became invisible but process exists in task manager. Is their any way to get console again. We have console show but where to run it?

Attaching 8.6 wish shell with hide console option

Upvotes: 1

Views: 405

Answers (2)

schlenk
schlenk

Reputation: 7247

Might be a bit the heavy handed approach, but this works, if you have the TWAPI package and the PID of the process:

% package require twapi
4.1.27

Now lets get the Window handles available for the the PID:

% set w [twapi::get_toplevel_windows -pid 2432]
{197612 HWND} {132106 HWND} {590378 HWND} {132100 HWND} {327716 HWND}  {132098 HWND} {132094 HWND} {393624 HWND}

One of those windows should be the hidden console:

% foreach win $w {
>   puts "[twapi::get_window_text $win] Handle: $win"
> }
Konsole Handle: 197612 HWND
TclNotifier Handle: 132106 HWND
wish Handle: 590378 HWND
E Handle: 132100 HWND
M Handle: 327716 HWND
TtkMonitorWindow Handle: 132098 HWND
MSCTFIME UI Handle: 132094 HWND
Default IME Handle: 393624 HWND

This is a German windows, so for me the Konsole is the right one, lets show it again:

% twapi::show_window {197612 HWND}
1

And now the console is back and you can use it.

Upvotes: 1

Colin Macleod
Colin Macleod

Reputation: 4382

Do you have a Tk gui that you can interact with? If so, one option is to bind a key so that when pressed in your gui it opens the console. E.g. if the toplevel gui window is "." and you choose key F2, add the following to your Tk code:

bind . <F2> {console show}

Upvotes: 3

Related Questions