Itcl/Tcom/Tcl/Threads: Is this thread continuously running


In of the places I have written itcl code in a thread that kills excel

method Kill_XL {} {
    thread::create {
        set rc [catch {exec taskkill /t /f /im Excel*} output]
    sleep 5

After that, for several different wish shells the following command invokes Excel App but I can see it immediately exiting in task manager

(shh..) 2 % ::tcom::ref createobject Excel.Application
(shh..) 3 % ::tcom::ref createobject Excel.Application

The above is repeated for a several wish shells (each invoked after closing the previous wish shell).

On running any command, the error appears as:

"invalid command name ::tcom::handle0x027CE918"

But the following code works and opens up a Word application without a problem

(shh..) 4 % ::tcom::ref createobject Word.Application

After waiting for a long time (15-20 minutes), I restarted the wish shell and was able to run (without problem) the following code:

(shh..) 8 % set x [::tcom::ref createobject Excel.Application]
(shh..) 9 % $x Visible 1

And a different error message this time after killing excel

(shh..) 10 % thread::create {
                set rc [catch {exec taskkill /t /f /im Excel*} output]

(shh..) 11 % $x Visible 0
0x800706ba {The RPC server is unavailable.}

And then is starts all over again:

(shh..) 20 %  ::tcom::ref createobject Excel.Application
(shh..) 21 % 
(shh..) 21 % ::tcom::handle0x0272EB58 Visible 1
invalid command name "::tcom::handle0x0272EB58"

Is the threaded kill causing problems - I am always sleeping 5 seconds to ensure the kill is successful.

Or is it some other (known) issue with tcom-Excel?

Also, giving the same app handles all the time

(shh..) 30 % foreach x  {. .} {puts [::tcom::ref createobject Excel.Application]}

Could this be a cleanup issue with unreleased tcom objects - does it not clenaup automatically on killing the excel process associated?

asked on Stack Overflow Feb 20, 2017 by zip_lock_throw • edited Feb 20, 2017 by zip_lock_throw

1 Answer


This was some problem with the OS - doesn't get repeated after OS was re-imaged.

answered on Stack Overflow Apr 7, 2017 by zip_lock_throw

User contributions licensed under CC BY-SA 3.0