Trying to figure out take command...

rkm

Aug 23, 2015
6
0
#1
Hi, I bought TakeCommand 17 a while back but haven't used it much because I keep getting stuck when trying to use some of the features. One of them I'm trying to understand is how I can create a button to execute a command with an argument passed to it. If I create a button and add an argument, then take command tells me it can't find the command. How do you create a button to run a command in a tabe but have an argument passed to it?

Thanks!
 

rkm

Aug 23, 2015
6
0
#2
Actually, it doesn't seem like I can run any command with a button. I just get a dialog box which shows the command I was trying to run and that's all.
 
#3
Can you be more precise about what you want to do? I'm not having any problem. The picture below shows a button, the dialog used to create it (command with argument), and the result of a left-click on the button (the tab showing "Connected ...").
upload_2015-8-23_13-19-5.png
 

Charles Dye

Super Moderator
Staff member
May 20, 2008
3,725
47
Albuquerque, NM
prospero.unm.edu
#4
Are you trying to run an internal command? If so, you run TCC.EXE with either the /C or /K option, and add the command (and any args) after that:

Int-Command-Button.png

/K runs the command, and then dumps you at the prompt. /C runs the command and then exits immediately.

I think that if you don't give a path, Take Command will pick up the TCC.EXE in its own directory -- probably what you want. I might be mistaken about that, though.

Note the doubled percent sign on the variable. If you use a single percent sign, the variable will be expanded by Take Command before launching TCC.EXE; this may or may not be what you want....
 
Jun 2, 2008
284
1
Newton, MA
#5
Actually, it doesn't seem like I can run any command with a button. I just get a dialog box which shows the command I was trying to run and that's all.
If you want to run a command as if you were typing it into the TCC tab window, then use the "Send to the current tab" option in the dialog and the syntax for sending characters (see the help file for the toolbar).

For example, I have a button called EREN that invokes the eren command on the currently selected file in the window. The entry in the "Command" box in the dialog is as follows:

esc "eren %%@quote[%_selected]" enter​

(ESC is there to clear anything that might already be on the command line, and the @QUOTE function takes care of cases where the selected file name has characters that require quoting.)
 

rkm

Aug 23, 2015
6
0
#6
Sorry, I got a bit tied up and have been just using the command prompt for now. So if you look at the 2 files that end with _1.png, that's the first attempt to run tomcat 8.x with take command (well after I had to modify the tomcat batch file because take command doesn't interpret it the same as the command prompt, one of the quotes gets lost causing it not to run). Originally I thought maybe the space with an argument was the problem, so I switched to using a batch file (the 2 images ending with _2.png) which ran the same command as specified in the first example. For some reason, characters get lost.

As I mentioned above, the Apache Tomcat batch file doesn't run like it does in the command prompt either. You might have to look at it to see what I mean, but there is a substitution of a variable with text containing quotes which gets substituted on another line which is surrounded with quotes. This causes one of the double quotes to get dropped in the resulting command (so you end up with an unterminated quote) and then the command doesn't run. I took out a set of quotes in the batch file so that it still runs in the command prompt and if I type in one of the above commands that I'm trying to assign to a button, directly into the take command prompt, it then works fine that way. It took me a bunch of time to figure out why tomcat wouldn't run with take command (because echo is turned off in the batch file and it tries to open the command in a new window by default).

I really want to leverage take command but I'm worried that I'll keep running into problems I wouldn't hit with the command prompt and therefore every time take command fails, I'll feel like I have to try with the normal command prompt to see if the problem is my fault or take command's. I don't do anything complicated, or advanced scripting, I just want a tabbed interface and be able to customize things to be as convenient as possible for running things from a command prompt (such as running a maven build, updating source code from a source repository, running different servers locally that I'm developing against).

Thanks for any help.

Ryan
 

Attachments

rkm

Aug 23, 2015
6
0
#7
Also, when you send a command to the current window, isn't there a way to make it execute instead of having to hitting enter? I was able to get tomcat to run if I run it by using tcc. I created a button to run the MongoDB server exe, "in a new window" and without tcc, and it opened it in a new tab, which is fine. I then tried to add another button to run a command without tcc and that one starts in a new dos window, which I don't want. I tried to add a command button to change the current directory (using the change directory radio button), but that button does absolutely nothing. It doesn't feel like there is consistency between how the buttons need to be defined to get them to work,.
 

rkm

Aug 23, 2015
6
0
#11
Strange, I thought I had tried it with the text quoted, but I guess maybe that was it. Not sure why it needs to be, but at least that works.
 
#12
Strange, I thought I had tried it with the text quoted, but I guess maybe that was it. Not sure why it needs to be, but at least that works.
Because there has to be a way to distinguish between text you want sent to the tab, and keystrokes you want sent to the tab. The rule is, text in quotes, key names without quotes. So this, or something similar, should serve you well.
Code:
"c:\apps\tomcat-8.0.24\bin\catalina.bat run" Enter
TCMD wastrying to parse the string as if it were key names (and doing a bad job of it); hence the mangled text.