1

I am making this GUI'ed TCL script with ActiveTCL & Expect.

But for some reason Expect doesn't work with telnet that comes with windows 8 64bit, so I figured a way to use a custom telnet tcl script. It works fine, but I need now to wrap my script with the telnet script and some logo images into a single .exe to run without extra files in directory, but I can't for the life of me get it to work.

I click add files to the tclapp wrapper but it says file not found on the script when it tries to call for the telnet script.

Donal Fellows
  • 133,037
  • 18
  • 149
  • 215
Nikaido
  • 13
  • 4
  • The system telnet on Windows is marked as a system binary (special filesystem flag) and that makes it impossible to attach a debug engine to, which is how Expect-on-Windows works under the hood. Just so as you know. – Donal Fellows Nov 09 '13 at 08:48
  • Are you trying to run your telnet script as its own wrapped executable? – Donal Fellows Nov 09 '13 at 08:49

1 Answers1

0

When you wrap Tcl code into a single-file executable, everything goes inside. Scripts, libraries, any images (assuming you're making a GUI), the lot. Tcl transparently extracts things and pretends you've got a real filesystem. However, when you execute a program (whether via exec, open |… or spawn) then the OS must be involved as you are creating a subprocess — the OS is always involved in that, as process management is one of the main things that the OS kernel does — and it needs to have a real executable to run. If you have packaged up your telnet-replacement as its own single-file executable and stored it inside the parent process's VFS, you have to make that subordinate process executable real.

Copy the telnet-executable out to some location (e.g., to the temporary directory, which I think should be described in $::env(TEMP)) and execute that.

set realTelnetExe [file join $::env(TEMP) mytelnet.exe]
file copy .../the/stored/copy/mytelnet.exe $realTelnetExe

spawn $realTelnetExe
# ...

You probably want to file delete the copy once you're done using it.

Relevant background material:

Donal Fellows
  • 133,037
  • 18
  • 149
  • 215
  • I think we missunderstood each other my telnet is a script not an exe. I could try to find winxp telnet to use with it since it works well with active TCL but I cant make it work with w8 64bit telnet client – Nikaido Nov 10 '13 at 20:05