Questions about TC parameters: why small letters? Need to quote variables?

English support forum

Moderators: white, Hacker, petermad, Stefan2

Post Reply
User avatar
AntonyD
Power Member
Power Member
Posts: 1246
Joined: 2006-11-04, 15:30 UTC
Location: Russian Federation

Questions about TC parameters: why small letters? Need to quote variables?

Post by *AntonyD »

%X Interprets the following parameters after this parameter as left/right instead of source/target:
%P, %p (left path), %T, %t (right path), %N, %n (left name), %M, %m (right name),
%S, %s (left selected), %R, %r (right selected)
Example: %X%P %T sends left and right path to e.g. an external sync tool
this is from help file.
1) why big and small letters?
2) what - if want to operate with selected files - but they are do exist only on some one panel?
how in this case string line |%X%S %R| will be interpreted?
In another words - how to correctly start SyncDir tool in standalone copy of TC with "Only selected (in main window)"
and of course TC must by itself to find out which file are selected and where do they selected. Exactly as it does in
regular case - when I start NOT a standalone version of SyncDir tool.
3) very often we need to quote variables with paths. So HOW in this case I should use "?
"%X%P %T"
%X"%P %T"
"%X%P" "%T"
%X"%P" "%T"
#146217 personal license
User avatar
petermad
Power Member
Power Member
Posts: 14793
Joined: 2003-02-05, 20:24 UTC
Location: Denmark
Contact:

Re: Small questions

Post by *petermad »

2AntonyD
1) why big and small letters?
Big letters = long file name/path, small letter = 8.3 (DOS) names:
Help wrote:Notes: %N and %M insert the long name, while %n and %m insert the DOS alias name (8.3). %P and %T insert the long path name, and %p and %t the short path name (Same for %o, %e, %b and %s). %p/%t inserts the ftp URL of the directory for ftp connections.
By putting %P, %p, %T or %t directly in front of %S or %s, the path name is inserted with the file name for each file. Example: %P%S inserts the long path and file name for all selected files.


In another words - how to correctly start SyncDir tool in standalone copy of TC with "Only selected (in main window)"
and of course TC must by itself to find out which file are selected and where do they selected. Exactly as it does in
regular case - when I start NOT a standalone version of SyncDir tool.
This em_command should do it:

Code: Select all

[em_ext_sync2]
cmd=%COMMANDER_EXE% /i="%COMMANDER_INI%" /S=S
param=%Z%X "%P" "%T" /O1O=%WL
menu=Synchronize Directories, only selected (separate instance)
button=%COMMANDER_EXE%,32
Actually /O=%WL should work, but there is a bug in TC 10.52 that makes the use of /O1O=%WL necessary see: viewtopic.php?p=423692#p423692


3) very often we need to quote variables with paths. So HOW in this case I should use "?
%X"%P" "%T" would be correct.

%N and %M will automatically insert quote marks for names with spaces and so will %P%N adn %T%M
License #524 (1994)
Danish Total Commander Translator
TC 11.03 32+64bit on Win XP 32bit & Win 7, 8.1 & 10 (22H2) 64bit, 'Everything' 1.5.0.1371a
TC 3.50 on Android 6 & 13
Try: TC Extended Menus | TC Languagebar | TC Dark Help | PHSM-Calendar
Fla$her
Power Member
Power Member
Posts: 2296
Joined: 2020-01-18, 04:03 UTC

Re: Small questions

Post by *Fla$her »

petermad wrote: โ†‘2023-03-26, 13:18 UTCparam=%Z%X "%P"
Why is there an extra space?
petermad wrote: โ†‘2023-03-26, 13:18 UTC%M will automatically insert quote marks for names with spaces
No, remember.
Overquoting is evil! ๐Ÿ‘Ž
User avatar
AntonyD
Power Member
Power Member
Posts: 1246
Joined: 2006-11-04, 15:30 UTC
Location: Russian Federation

Re: Small questions

Post by *AntonyD »

Fla$her wrote: โ†‘2023-03-26, 14:07 UTC No, remember.
I read this discussion and did not understand at all - why did the author suddenly decide not to fix something - which is clearly a bug?
%M should of course be automatically quoted as well as %N
And suddenly this behavior will not be changed... It becomes strange and scary.
2petermad
This em_command should do it:
And yes- huge thanks! It works!
#146217 personal license
User avatar
AntonyD
Power Member
Power Member
Posts: 1246
Joined: 2006-11-04, 15:30 UTC
Location: Russian Federation

Re: Small questions

Post by *AntonyD »

And one more small question.
command "CM_EXIT 9" - does very cool job.
BUT! As I see - selections in both panels are not preserved. Is here some workaround about it?
#146217 personal license
User avatar
Horst.Epp
Power Member
Power Member
Posts: 6480
Joined: 2003-02-06, 17:36 UTC
Location: Germany

Re: Small questions

Post by *Horst.Epp »

AntonyD wrote: โ†‘2023-03-26, 16:47 UTC And one more small question.
command "CM_EXIT 9" - does very cool job.
BUT! As I see - selections in both panels are not preserved. Is here some workaround about it?
This works perfect here and restores the tabs and cursor postion on both sides.
No one said that selections will be restored.
Windows 11 Home x64 Version 23H2 (OS Build 22631.3447)
TC 11.03 x64 / x86
Everything 1.5.0.1371a (x64), Everything Toolbar 1.3.3, Listary Pro 6.3.0.73
QAP 11.6.3.2 x64
User avatar
AntonyD
Power Member
Power Member
Posts: 1246
Joined: 2006-11-04, 15:30 UTC
Location: Russian Federation

Re: Small questions

Post by *AntonyD »

No one said that selections will be restored.
Exactly because of this I am asking my question.
WHY this was not done? and IS here some workaround for making this case real?
#146217 personal license
User avatar
Horst.Epp
Power Member
Power Member
Posts: 6480
Joined: 2003-02-06, 17:36 UTC
Location: Germany

Re: Small questions

Post by *Horst.Epp »

AntonyD wrote: โ†‘2023-03-26, 19:02 UTC
No one said that selections will be restored.
Exactly because of this I am asking my question.
WHY this was not done? and IS here some workaround for making this case real?
Because its not easy to do and at lest for me not necessary.
You can make a request for adding this function in some TC future versions.

Until this you can save any selections into files and restore them after an TC restart.
Make em_commands to save your selections and combine this with the exit 9.
May be you can then use the Autorun plugin to load your selections on TC startup.
Windows 11 Home x64 Version 23H2 (OS Build 22631.3447)
TC 11.03 x64 / x86
Everything 1.5.0.1371a (x64), Everything Toolbar 1.3.3, Listary Pro 6.3.0.73
QAP 11.6.3.2 x64
Fla$her
Power Member
Power Member
Posts: 2296
Joined: 2020-01-18, 04:03 UTC

Re: Small questions

Post by *Fla$her »

AntonyD wrote: โ†‘2023-03-26, 16:42 UTC why did the author suddenly decide not to fix something - which is clearly a bug?
%M should of course be automatically quoted as well as %N
I agree, but for some reason the author is worried about other users who have old codes:
ghisler(Author) wrote: โ†‘2022-04-28, 07:48 UTC However, I may break a lot of people's buttons when I surrounded all %M with quotes

AntonyD wrote: โ†‘2023-03-26, 19:02 UTCWHY this was not done?
>>>
ghisler(Author) wrote: โ†‘2022-10-04, 16:22 UTC It does return to directories opened in tabs which are locked but with directory changes allowed. However, it does not restore the scroll position or selected files, there are no parameters to do this and there is no easy way to add it either.

AntonyD wrote: โ†‘2023-03-26, 19:02 UTCand IS here some workaround for making this case real?
With a script or a combination of TCFS2 and the code in autorun.cfg to restart.
In my opinion, you are slowly turning the topic into your chat. A convenient title, there's nothing to say. :lol:
Overquoting is evil! ๐Ÿ‘Ž
User avatar
petermad
Power Member
Power Member
Posts: 14793
Joined: 2003-02-05, 20:24 UTC
Location: Denmark
Contact:

Re: Small questions

Post by *petermad »

Fla$her wrote: โ†‘2023-03-26, 14:07 UTC
petermad wrote: โ†‘2023-03-26, 13:18 UTC%M will automatically insert quote marks for names with spaces
No, remember.
Yes I forgot - I must be getting old - can't even remember my own bug reports :oops:

The lack of auto-quoting %M is really inconsistant since %R is auto-quoted.
License #524 (1994)
Danish Total Commander Translator
TC 11.03 32+64bit on Win XP 32bit & Win 7, 8.1 & 10 (22H2) 64bit, 'Everything' 1.5.0.1371a
TC 3.50 on Android 6 & 13
Try: TC Extended Menus | TC Languagebar | TC Dark Help | PHSM-Calendar
User avatar
AntonyD
Power Member
Power Member
Posts: 1246
Joined: 2006-11-04, 15:30 UTC
Location: Russian Federation

Re: Small questions

Post by *AntonyD »

In this saving or submitting? of selection in em_ cmd OR there is an error, OR I do not understand something.
We take two test directories. One has 4 files, the other has the same 4 files plus one new, completely different.
We select everything here and there. We call the dependent synchronization window. It has a checkmark
"Only selected (in main window)" turned on and it shows 4 files on one side and 5 on the other! That's right
and logical. Now we call an INdependent synchronization window using the new em_ method. And we see
that we are offered !4 and 4! files IF the cursor was in the panel, where there were 4 files initially.
And 4 and 5 files, IF the cursor was in a panel where there were 5 files initially. And if you check the work
of independent window - it turns out to be NOT important there - where the cursor is located at the time
when the command was called!!!
Why we have this difference? And how to eliminate it?
#146217 personal license
Fla$her
Power Member
Power Member
Posts: 2296
Joined: 2020-01-18, 04:03 UTC

Re: Small questions

Post by *Fla$her »

AntonyD wrote: โ†‘2023-03-27, 10:26 UTCWhy we have this difference? And how to eliminate it?
The logic is simple: only the list that is highlighted in the active panel is taken into account โ€” %WL. An additional parameter is needed to select an inactive one. You can request a new switch and the effect of %X/%x on the lists here. Again, you can eliminate this with a script by gluing the lists together.
Overquoting is evil! ๐Ÿ‘Ž
User avatar
AntonyD
Power Member
Power Member
Posts: 1246
Joined: 2006-11-04, 15:30 UTC
Location: Russian Federation

Re: Small questions

Post by *AntonyD »

Another confusing point about file selections.
If I make any changes to a file in this tool, when I close the main window of the SyncDir, the files in the panel with that file will be deselected.
I don't expect that, though. In addition, the selection will still be saved in the other panel! If it was necessary to remove this selection (although I do not see the slightest indication of the need for it) - then at once in both panels.
#146217 personal license
Fla$her
Power Member
Power Member
Posts: 2296
Joined: 2020-01-18, 04:03 UTC

Re: Small questions

Post by *Fla$her »

Confirm. Write to the bugs section.
Overquoting is evil! ๐Ÿ‘Ž
User avatar
petermad
Power Member
Power Member
Posts: 14793
Joined: 2003-02-05, 20:24 UTC
Location: Denmark
Contact:

Re: Small questions

Post by *petermad »

2AntonyD
Now we call an INdependent synchronization window using the new em_ method. And we see
that we are offered !4 and 4! files IF the cursor was in the panel, where there were 4 files initially.
And 4 and 5 files, IF the cursor was in a panel where there were 5 files initially
Sorry the command line paramter /S=S only supports on list of files (the files marked in the active panel) using the /O parameter
License #524 (1994)
Danish Total Commander Translator
TC 11.03 32+64bit on Win XP 32bit & Win 7, 8.1 & 10 (22H2) 64bit, 'Everything' 1.5.0.1371a
TC 3.50 on Android 6 & 13
Try: TC Extended Menus | TC Languagebar | TC Dark Help | PHSM-Calendar
Post Reply