How to send TC parameters to other apps?

English support forum

Moderators: Hacker, petermad, Stefan2, white

Post Reply
fastrun
Junior Member
Junior Member
Posts: 6
Joined: 2012-09-09, 03:57 UTC

How to send TC parameters to other apps?

Post by *fastrun »

Hello, all,

I'd like to send some useful parameters to other apps for some kind of sequential action.
Do you know how to achieve it?

For example, I need to get the current source path, copy it to another directory with Xcopy command, then compressed it and send it by outlook with winrar command line.

Currently I can only use two buttons to achieve it, because I don't know how to pass the source path to winrar command line.

But what I want is to integrate all the above actions to a single button on the button bar.

Pls. help.
Thx.
User avatar
MVV
Power Member
Power Member
Posts: 8711
Joined: 2008-08-03, 12:51 UTC
Location: Russian Federation

Post by *MVV »

I'll open a world's greatest secret to you: if you press F1 in buttonbar button's edit dialog, you'll see how to pass source path and many other useful things to application. :wink:

Also, you can call batch file instead of winrar directly so multiple commands may be executed via a single button.
User avatar
AKE
Junior Member
Junior Member
Posts: 14
Joined: 2012-09-05, 03:45 UTC
Location: London, UK
Contact:

Post by *AKE »

You have a lot of choices:

Here's a quick summary:
%P gives the full path (but not the filename)
%N gives the full file name with extension
%O gives filename ONLY (no extension)
%E gives the extension
%S gives the file names of all selected files
%L writes the full path and filename of all selected files to a temp file and passes the LOCATION of that temp file to the program.
lower case variations (e.g. %p, %n, etc.) use the DOS 8.3 alias convention
%T, %M, %R give the equivalent of %P, %N, %S but for the TARGET panel instead of the source panel.

The full list can be found in Help (F1), go to Index and type:
Dialog Box: Configuration: Change Button Bar.
Then scroll down the page to Parameters.

This should give you everything you need and more!
fastrun
Junior Member
Junior Member
Posts: 6
Joined: 2012-09-09, 03:57 UTC

Post by *fastrun »

AKE wrote:You have a lot of choices:

Here's a quick summary:
%P gives the full path (but not the filename)
%N gives the full file name with extension
%O gives filename ONLY (no extension)
%E gives the extension
%S gives the file names of all selected files
%L writes the full path and filename of all selected files to a temp file and passes the LOCATION of that temp file to the program.
lower case variations (e.g. %p, %n, etc.) use the DOS 8.3 alias convention
%T, %M, %R give the equivalent of %P, %N, %S but for the TARGET panel instead of the source panel.

The full list can be found in Help (F1), go to Index and type:
Dialog Box: Configuration: Change Button Bar.
Then scroll down the page to Parameters.

This should give you everything you need and more!
Thanks for your hint.
I know there are lot of parameters in help file, which are located in "Dialog box: Change start menu".
The only thing I concerned is that a single button can not excute two or more commands sequentially.

For example:
move %P%N D:/test
del %P%N
fastrun
Junior Member
Junior Member
Posts: 6
Joined: 2012-09-09, 03:57 UTC

Post by *fastrun »

MVV wrote:I'll open a world's greatest secret to you: if you press F1 in buttonbar button's edit dialog, you'll see how to pass source path and many other useful things to application. :wink:

Also, you can call batch file instead of winrar directly so multiple commands may be executed via a single button.
Thanks a lot for disclosuring the world's greatest secret.
:)
I've try that already.

Just as I replied in previous post,
it seems hard to excute sequential commands in a single button.
Maybe batch is a good idea, I'll try it later.

But before I try it, I can imagine that there will be a black prompt window, How to avoid this?
By using nircmd to hide it? Seems not so good.
Is there any better idea?
User avatar
Hacker
Moderator
Moderator
Posts: 13144
Joined: 2003-02-06, 14:56 UTC
Location: Bratislava, Slovakia

Post by *Hacker »

fastrun,
The only thing I concerned is that a single button can not excute two or more commands sequentially.

For example:
move %P%N D:/test
del %P%N
Perhaps they could be chained using "&&"?

HTH
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
MVV
Power Member
Power Member
Posts: 8711
Joined: 2008-08-03, 12:51 UTC
Location: Russian Federation

Post by *MVV »

fastrun, you can set 'Minimized' flag for that button so no black window will appear, just a taskbar button that will appear and then disappear (it is almost invisible w/o any third-party tools).
User avatar
AKE
Junior Member
Junior Member
Posts: 14
Joined: 2012-09-05, 03:45 UTC
Location: London, UK
Contact:

Post by *AKE »

As far as I have tried, buttons launch an application either directly or via association. So windows shell commands don't work directly from a button -- there is no implict context to execute instructions within the cmd shell... for this reason I don't think chaining with && will help -- that's a technique for a batch script.

Batch scripts seems the way to go if you all you want to do is multiple commands. Batch arguments are now more flexible, not only %1, but also %~n1 and %~x1.

%1 references the first command line argument,
%~n1 references JUST the filename (without extension)
%~x1 references extension only, etc.
and there are more variations (see `help for` in cmd shell)
User avatar
MVV
Power Member
Power Member
Posts: 8711
Joined: 2008-08-03, 12:51 UTC
Location: Russian Federation

Post by *MVV »

AKE, it is possible to use multiple commands in a single line:

Code: Select all

Command: cmd /c echo Hello World & pause

Code: Select all

Command: cmd /c
Parameters: echo Hello World & echo %P%N & pause
But anyway batch file is more convenient.
User avatar
AKE
Junior Member
Junior Member
Posts: 14
Joined: 2012-09-05, 03:45 UTC
Location: London, UK
Contact:

Post by *AKE »

@MVV:
Very nice tip - thanks. (Batch is more convenient, but good to know of other methods.)
fastrun
Junior Member
Junior Member
Posts: 6
Joined: 2012-09-09, 03:57 UTC

Post by *fastrun »

MVV wrote:fastrun, you can set 'Minimized' flag for that button so no black window will appear, just a taskbar button that will appear and then disappear (it is almost invisible w/o any third-party tools).
MVV wrote:AKE, it is possible to use multiple commands in a single line:

Code: Select all

Command: cmd /c echo Hello World & pause

Code: Select all

Command: cmd /c
Parameters: echo Hello World & echo %P%N & pause
But anyway batch file is more convenient.
Thanks so much!
Yes, you finished this task perfectly.
Thanks a again!
fastrun
Junior Member
Junior Member
Posts: 6
Joined: 2012-09-09, 03:57 UTC

Post by *fastrun »

Find another method to avoid black prompt cmd window by using "nircmd", a very tiny powerful command line tool.


For instance:
you can use the following command in button bar to creat a new folder in the target window with current file name:
command: nircmd.exe
parameters: execmd MD "%T%O"
start path: %COMMANDER_PATH%\TOOLS\
User avatar
MVV
Power Member
Power Member
Posts: 8711
Joined: 2008-08-03, 12:51 UTC
Location: Russian Federation

Post by *MVV »

fastrun, BTW there are some tools that allow to hide console windows of launched commands... They simply don't show any console window (but allow to start console apps like cmd).
fastrun
Junior Member
Junior Member
Posts: 6
Joined: 2012-09-09, 03:57 UTC

Post by *fastrun »

MVV wrote:fastrun, BTW there are some tools that allow to hide console windows of launched commands... They simply don't show any console window (but allow to start console apps like cmd).
Yes, you are right.
Nircmd can do this too.
Now this problem fixed perfectly.
Post Reply