Opening a tcl program from another - tcl

I have a tcl application that I want to open from another tcl application. When I open it the opened app appears within the main app, over the top of quarter of it. Does anyone know how to make the opened app appear as a seperate window?
I think it may have something to do with WM WINDOW.

If you use the source command, you don't really start another application. You're just loading additional code into your existing application. To actually start another application you can use exec tclsh otherapp.tcl.
To get two separate windows when sourcing two files into the same interpreter, they should use seperate toplevels, as Glenn mentioned.
If you don't want to modify the file you are sourcing, another possibility is to load each file into their own interpreter.
interp create app2
app2 eval {source otherapp.tcl}
Make sure your app files contain package require Tk when you want to use this technique.

Related

How to use multiple of the same executable on UGUI

I am using this tool to create a simple GUI with it's easy to understand set up: https://github.com/UniversalGUI/UGUI
But from what I understand from its guides that it needs executables to be in different names so that it can differentiate itself and the form sending it. The project I am doing needs me to use the same command but with different arguments such as:
<cmd executable="xdg-open">
<arg>/home/kali/Downloads/</arg>
</cmd>
I need to open other folders in different parts of the program using that executable. In the guides, the person did use an .exe file which I figured is a script included in its folder and I did try to replicate it but to no luck. https://www.youtube.com/watch?v=qHMRroZ7AAw
The tool isn't used by many but those who do, do you know how to get over this issue?

Pass file name to build script in PhpStorm

I have the next configuration for a build system in PhpStorm:
And it works ok, but I have a problem... my build script needs to receive the name of the file I'm running it on, so, if I build a PHP file, it will run phpcs on it, but if I'm building a CSS or JS file, it will run gulp... with Sublime Text that is possible, is it possible with PhpStorm?
There are no macros support for Run/Debug Configurations -- they are made so they do not depend on a context (currently opened file in editor). In other words -- they are pretty static and all file names/paths are basically hard coded.
For what you are describing (build script).. you need to use External Tools functionality (which can have all of that and made specifically for such tasks). Once created, you can assign custom shortcut to any External Tools entry (check Settings/Preferences | Keymap for that) so it's more convenient to use it.
If you want such script to be called on every file save automatically -- then use File Watchers -- pretty much external tools that will be called for you automatically (once per each file modified).
Since you are doing this for a build script -- maybe you should try to use dedicated (and therefore more appropriate in general) tools? For example: Gulp / Grunt .. or even Phing.
Create external tool:
https://www.jetbrains.com/phpstorm/help/external-tools.html
You can assign hotkey to execute your build command.

Need assistance with Tclapp wrapping

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.
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:
comp.lang.tcl thread

Building Windows Store app programmatically

We have a requirement of creating several Windows 8 apps for tablets. There is a common solution and news apps are created by passing different resource to the same code.
For Mobile it was a cakewalk - Used the Microsoft.Build.Evaluation.Project class to get the xap file.
But for Surface, building from code does not give the direct appx output, while building using MSBuild gives appx as the output.
I tried several methods to avoid calling MSBuild from C#(by creating a Command Process) like creating a zip file - myapp.appx - and then signing it using this c++ code. It didn't workout because of an extern reference and I gave up.
Then I tried to use SignTool.exe by creating a Command Process in C#. That too failed.
So, I am wondering if there is any way to build an appx directly from C# without MSBuild.
The reason why I am trying to avoid MSBuild is to get a status from the build process, which Microsoft.Build.Evaluation.Project.Build() provides.
First try adding a pfx key to your project and then try the build via Microsoft.Build.Evaluation.Project.Build() again. The pfx is required from what I read:
See Candy's answer here:
MSBuild target to create the .appx package
So then the trick would be to use SignTool to get the pfx in the first place and update the project with that pfx, but first see if the above works.

WIX: Using a temporary file during install

I am writing a WIX installer and I have a following requirement:
During installation, I need to pass an absolute path to a file (lets call it A) included in my installer to a COM component, which already exists on the hard drive and is a part of another program. I have already written an appropriate Custom Action which expects a path to the file A. I don't want to include A as a file installed in the Program Files folder and removed during the uninstallation process. Instead, I would like to put A only temporary on the hard drive, call my Custom Action which will cause the COM component to use the content of A, and then remove A from disk. Is there an easy way to accomplish this goal?
I have tried to utilize the Binary Table and store A there, however I don't know how to reference A using absolute path. I know I could put A outside of MSI file but I would like to keep every file installer needs in a single MSI.
Any help would be appreciated.
Deleting a file that MSI installed means that MSI will consider it "broken" and try to auto-repair it if called on to do so. That happens automatically in several cases (e.g., advertised shortcuts and COM registration) so I'd recommend against it. Leave the file there instead -- it's done its job and there's no harm in leaving it there.
I would take this approach.
Install the file "A" into any directory. Run your custom action needed to update the COM component. Then run another custom action or modify the currently written one to remove the file after it is no longer in use. This would leave no trace of the file "A" and if you schedule the custom action to only run during the install you won't have to worry about it on uninstall.