multiple commands in one button

English support forum

Moderators: Hacker, petermad, Stefan2, white

Post Reply
sammy
Junior Member
Junior Member
Posts: 7
Joined: 2003-12-25, 19:19 UTC

multiple commands in one button

Post by *sammy »

Hi,

I am newbie to TC. I wonder how do make the following in one button:

cm_opennewtab
cd c:/windows

Thanks
User avatar
klark
Member
Member
Posts: 189
Joined: 2003-02-07, 17:34 UTC
Location: Germany, Düsseldorf

Post by *klark »

hi sammy

AFAIK, this is not possible right now, because you can not use TC-internal commands in a batch, and the choice of a start-path has no effect to internal commands - as in the help defined.

If anyone has got a workaround for this problem: I would be interested, too! :P

The only one, I can give: Create 2 buttons: one for the new tab, the other one to change to C:/Windows. Not very smart, I must admit :?

Best regards,
Marc
User avatar
Hacker
Moderator
Moderator
Posts: 13141
Joined: 2003-02-06, 14:56 UTC
Location: Bratislava, Slovakia

Post by *Hacker »

Well, the easy way would be:
1. Make sure you have only one Tab open in the curent panel and that it points to C:\Windows
2. Right-click on the tab-header (you need to have Configuration - Options - Folder Tabs - Show tab header also when there is only one tab enabled for this step) and select Save tabs to file
3. Save the file
4. Add a new button o the Button Bar with the command APPENDTABS <tabfile.tab> where <tabfile.tab> is the file you saved the tab into.

Now you should only need to click that button and a new tab with C:\Windows should open.


The difficult way would be to use Aezay's TC Script Editor, which you can search for on this forum ("script editor").

HTH
Roman
User avatar
SanskritFritz
Power Member
Power Member
Posts: 3693
Joined: 2003-07-24, 09:25 UTC
Location: Budapest, Hungary

Post by *SanskritFritz »

The difficult way would be to use Aezay's TC Script Editor, which you can search for on this forum ("script editor").
I tried it, but the SendText being buggy, i could not get it to work. Even using the Directory Menu it didnt work :-(
I switched to Linux, bye and thanks for all the fish!
User avatar
klark
Member
Member
Posts: 189
Joined: 2003-02-07, 17:34 UTC
Location: Germany, Düsseldorf

Post by *klark »

@Hacker

That is cool. I didn't know this command. Thanks!
sammy
Junior Member
Junior Member
Posts: 7
Joined: 2003-12-25, 19:19 UTC

Post by *sammy »

Hacker wrote:Well, the easy way would be:
1. Make sure you have only one Tab open in the curent panel and that it points to C:\Windows
2. Right-click on the tab-header (you need to have Configuration - Options - Folder Tabs - Show tab header also when there is only one tab enabled for this step) and select Save tabs to file
3. Save the file
4. Add a new button o the Button Bar with the command APPENDTABS <tabfile.tab> where <tabfile.tab> is the file you saved the tab into.

HTH
Roman
Nice trick. Thanks.

However, it doesn't activate the new tab.
User avatar
franck8244
Power Member
Power Member
Posts: 704
Joined: 2003-03-06, 17:37 UTC
Location: Geneva...

Post by *franck8244 »

It works with TCScript Editor :D
Just read the code for explanation:

Code: Select all

//Open a new tab in %WINDIR%
#include VKeys.h
//SendVKey(VK_TAB,2) Uncomment to open the tab in the other panel
Sendcmd(cm_OpenNewTab);
//Activate or Focus the cmd line
SendVKey(VK_LSHIFT,1);
SendVKey(VK_LEFT,2);
SendVKey(VK_LSHIFT,0);

SendText("cd ");

//Emulate the "%"
SendVKey(VK_MENU,1);
SendVKey(VK_NUMPAD3,2);
SendVKey(VK_NUMPAD7,2);
SendVKey(VK_MENU,0);

SendText("WINDIR");

//Emulate the "%"
SendVKey(VK_MENU,1);
SendVKey(VK_NUMPAD3,2);
SendVKey(VK_NUMPAD7,2);
SendVKey(VK_MENU,0);

SendVKey(VK_RETURN,2); //Validate :)

/*Uncomment the whole bloc if you don't want focus on the new
tab but the previous one
SendVKey(VK_LCONTROL,1);
SendVKey(VK_TAB,2);
SendVKey(VK_LCONTROL,0);*/
:arrow: To open any directory, you can replace part of the code (between the "cd" command and the return instruction).
Example with "c:/windows/"

Code: Select all

SendText("C");
//Emulate the ":"
SendVKey(VK_MENU,1);
SendVKey(VK_NUMPAD5,2);
SendVKey(VK_NUMPAD8,2);
SendVKey(VK_MENU,0);
SendVKey(VK_DIVIDE,2); //  "/"
SendText("WINDOWS");
SendVKey(VK_DIVIDE,2);
I hope it will help...
TC#88260 -
User avatar
SanskritFritz
Power Member
Power Member
Posts: 3693
Joined: 2003-07-24, 09:25 UTC
Location: Budapest, Hungary

Post by *SanskritFritz »

2franck8244
That trick with the VK_MENU pressing i didnt know, i looked for the virtual key for colon and backslash ;-)
I switched to Linux, bye and thanks for all the fish!
User avatar
franck8244
Power Member
Power Member
Posts: 704
Joined: 2003-03-06, 17:37 UTC
Location: Geneva...

Post by *franck8244 »

2Sanskritfritz
i looked for the virtual key for colon and backslash
I also looked for those and I "found" :

Code: Select all

//VK_0 thru VK_9 are the same as ASCII '0' thru '9' ($30 - $39)
//VK_A thru VK_Z are the same as ASCII 'A' thru 'Z' ($41 - $5A)
That gave me the idea to try the ascii code combine with the "Alt" key (corresponding to the VK_MENU)...
TC#88260 -
User avatar
SanskritFritz
Power Member
Power Member
Posts: 3693
Joined: 2003-07-24, 09:25 UTC
Location: Budapest, Hungary

Post by *SanskritFritz »

That gave me the idea to try the ascii code combine with the "Alt" key (corresponding to the VK_MENU)...
Yeah, this idea didnt come to my mind, thanks for the tip!
I switched to Linux, bye and thanks for all the fish!
User avatar
Hacker
Moderator
Moderator
Posts: 13141
Joined: 2003-02-06, 14:56 UTC
Location: Bratislava, Slovakia

Post by *Hacker »

SanskritFritz,
I tried it, but the SendText being buggy, i could not get it to work.
Well, that's why se use SendVKey...

klark,
That is cool. I didn't know this command. Thanks!
Anytime.

sammy,
However, it doesn't activate the new tab.
Sorry, didn't test it. :oops:

Roman
Mal angenommen, du drückst Strg+F, wählst die FTP-Verbindung (mit gespeichertem Passwort), klickst aber nicht auf Verbinden, sondern fällst tot um.
User avatar
Aezay
Senior Member
Senior Member
Posts: 269
Joined: 2003-02-12, 07:27 UTC
Location: Denmark
Contact:

Post by *Aezay »

SanskritFritz wrote:I tried it, but the SendText being buggy, i could not get it to work. Even using the Directory Menu it didnt work :-(
Aezay wrote:Known Issues:
The SendText command does not work with special characters, only lowercase letters a to b and numbers 0 to 9. This shouldn't be to difficult to fix, I just need to put it through an ASCII -> Virtual Key converter. If I'm not mistaken, theres an API funtion for this, but i cant remember the name of it.
I feel kind of bad about not really working on this tool anymore, but if someone knows the API function to do this convertion, please let me know and ill update the tool so SendText could be fixed.
User avatar
pdavit
Power Member
Power Member
Posts: 1529
Joined: 2003-02-05, 21:41 UTC
Location: Kavala -> Greece -> Europe -> Earth -> Solar System -> Milky Way -> Space
Contact:

Post by *pdavit »

Aezay wrote:I feel kind of bad about not really working on this tool anymore, but if someone knows the API function to do this convertion, please let me know and ill update the tool so SendText could be fixed.
Long time no see Aezay!

You really shouldn't feel bad since you have given us one of the best tools around which is also my biggest wish
for an internal feature for TC.

Anyway, your interest might grow again with the release of v6.50 of TC which might need to introduce some new
commands for TCScriptEditor.

Take good care,
Panos

PS: Sorry for being OT... :oops:
"My only reason for still using M$ Window$ as an OS is the existence of Total Commander!"
Christian Ghisler Rules!!!
Boah
Junior Member
Junior Member
Posts: 20
Joined: 2003-11-20, 15:15 UTC
Location: London
Contact:

Post by *Boah »

Aezay wrote:If I'm not mistaken, theres an API funtion for this, but i cant remember the name of it.
Perhaps MapVirtualKey is what you are referring to? It can convert keyboard scan codes to virtual key codes, and vice versa.
User avatar
Aezay
Senior Member
Senior Member
Posts: 269
Joined: 2003-02-12, 07:27 UTC
Location: Denmark
Contact:

Post by *Aezay »

Boah wrote:
Aezay wrote:If I'm not mistaken, theres an API funtion for this, but i cant remember the name of it.
Perhaps MapVirtualKey is what you are referring to? It can convert keyboard scan codes to virtual key codes, and vice versa.
Thanks, ill take a look at it :)
Post Reply