cm_100Percent <parameter> for "auto-run commands" in view modes

English support forum

Moderators: white, Hacker, petermad, Stefan2

Post Reply
User avatar
funkymonk
Senior Member
Senior Member
Posts: 410
Joined: 2013-12-04, 09:56 UTC

cm_100Percent <parameter> for "auto-run commands" in view modes

Post by *funkymonk »

Gral wrote: 2022-05-20, 14:38 UTC cm_100Percent already works this way!
Did you try e.g.

Code: Select all

cm_100Percent 25
:?:
I played around a bit with this command to have it automatically adjust the panel widths for some of my view modes with many columns.
While doing so, I noticed two things for TC 10.50b6/x32/dark @ Win10x64:

1. In the "auto-run commands" you can combine "cm_100percent|cm_50percent" in a reasonable way, but no parameter for cm_100percent is supported here.

2. The "auto-run commands" are seemingly only executed when the mode is changed automatically -- but not when the mode is activated manually. However, this is not completely in line with the text in TC's help: "Commands to run when the view mode changes."

Are these behaviors intended or are they bugs?
(I can then post related messages in the correct forums.)
User avatar
tuska
Power Member
Power Member
Posts: 3741
Joined: 2007-05-21, 12:17 UTC

Re: Better custom columns view.

Post by *tuska »

funkymonk wrote: 2022-05-20, 21:48 UTC 1. In the "auto-run commands" you can combine "cm_100percent|cm_50percent" in a reasonable way,
    but no parameter for cm_100percent is supported here.
:?:
Auto-run commands: cm_FocusRight,cm_100Percent
Auto-run commands: cm_FocusRight,cm_100Percent 70
... works!
funkymonk wrote: 2022-05-20, 21:48 UTC 2. The "auto-run commands" are seemingly only executed when the mode is changed automatically --
    but not when the mode is activated manually.
    However, this is not completely in line with the text in TC's help: "Commands to run when the view mode changes."
Button with command:

Code: Select all

cm_SrcViewModeList NameOfViewMode
... works


Windows 10 Pro (x64) Version 21H2 (OS build 19044.1706) | TC 10.50b6 x64/x86
Overview: View Mode | Auto Switch Mode | Custom columns view -> 1. VIEW MODE
User avatar
funkymonk
Senior Member
Senior Member
Posts: 410
Joined: 2013-12-04, 09:56 UTC

Re: Better custom columns view.

Post by *funkymonk »

tuska wrote: 2022-05-20, 22:35 UTC
funkymonk wrote: 2022-05-20, 21:48 UTC 1. In the "auto-run commands" you can combine "cm_100percent|cm_50percent" in a reasonable way,
    but no parameter for cm_100percent is supported here.
:?:
Auto-run commands: cm_FocusRight,cm_100Percent
Auto-run commands: cm_FocusRight,cm_100Percent 70
... works!
True, but

Code: Select all

cm_100Percent 80 | cm_100Percent 70
does not.
In fact, parameter 70 is respected when leaving the view mode, but parameter 80 is ignored when activating the view mode (instead, 100 is used).
tuska wrote: 2022-05-20, 22:35 UTC
funkymonk wrote: 2022-05-20, 21:48 UTC 2. The "auto-run commands" are seemingly only executed when the mode is changed automatically --
    but not when the mode is activated manually.
    However, this is not completely in line with the text in TC's help: "Commands to run when the view mode changes."
Button with command:

Code: Select all

cm_SrcViewModeList NameOfViewMode
... works
Sure. That's a possible workaround. A workaround that requires manual action instead of the automatic change advertised in the documentation.
Here, TC's behavior is not in line with the text in the help file: "Commands to run when the view mode changes."

@ghisler
Would it be possible to have parameters respected for commands when activating *and* leaving a view mode?
And: Shouldn't the auto-run commands also be executed when activating/leaving a view mode *manually*?
User avatar
tuska
Power Member
Power Member
Posts: 3741
Joined: 2007-05-21, 12:17 UTC

Re: Better custom columns view.

Post by *tuska »

funkymonk wrote: 2022-05-21, 11:13 UTC True, but

Code: Select all

cm_100Percent 80 | cm_100Percent 70
does not.
In fact, parameter 70 is respected when leaving the view mode, but parameter 80 is ignored when activating the view mode (instead, 100 is used).
Good find!
funkymonk wrote: 2022-05-21, 11:13 UTC Button with command:

Code: Select all

cm_SrcViewModeList NameOfViewMode
... works

Sure. That's a possible workaround.
A workaround that requires manual action instead of the automatic change advertised in the documentation.
Here, TC's behavior is not in line with the text in the help file: "Commands to run when the view mode changes."
You have to distinguish between the fact that there is an automatic mode and that you can also trigger a View mode manually,
e.g. on any directory and not only on a directory that has been defined in the Auto Switch Mode.
The text in the help refers to a View mode WITH Auto Switch Mode and also applies only to the View mode.
funkymonk wrote: 2022-05-21, 11:13 UTC And: Shouldn't the auto-run commands also be executed when activating/leaving a view mode *manually*?
Theoretically this is already possible (Button ON/OFF), but one must reckon with the fact that this may be the case
that this could have an effect on the next View mode with Auto Switch Mode - it would be turned OFF!
Please see also: 7. HOW LONG DOES A VIEW MODE OR A CUSTOM COLUMNS VIEW REMAIN VISIBLE?
User avatar
white
Power Member
Power Member
Posts: 4594
Joined: 2003-11-19, 08:16 UTC
Location: Netherlands

Re: Better custom columns view.

Post by *white »

funkymonk wrote: 2022-05-21, 11:13 UTC

Code: Select all

cm_100Percent 80 | cm_100Percent 70
does not.
In fact, parameter 70 is respected when leaving the view mode, but parameter 80 is ignored when activating the view mode (instead, 100 is used).
As a workaround you can probably make an em_80percent (define as: cm_100percent 80) and use that.
User avatar
funkymonk
Senior Member
Senior Member
Posts: 410
Joined: 2013-12-04, 09:56 UTC

Re: Better custom columns view.

Post by *funkymonk »

white wrote: 2022-05-21, 22:16 UTC
funkymonk wrote: 2022-05-21, 11:13 UTC

Code: Select all

cm_100Percent 80 | cm_100Percent 70
does not.
In fact, parameter 70 is respected when leaving the view mode, but parameter 80 is ignored when activating the view mode (instead, 100 is used).
As a workaround you can probably make an em_80percent (define as: cm_100percent 80) and use that.
Thank you. Right, that's an option. However, my usercmd.ini already contains several of these em_ commands for exactly the reason that TC does not not support parameters in many situations. Let's add more until the problem is fixed... :wink:
tuska wrote: 2022-05-21, 13:23 UTC You have to distinguish between the fact that there is an automatic mode and that you can also trigger a View mode manually,
e.g. on any directory and not only on a directory that has been defined in the Auto Switch Mode.
The text in the help refers to a View mode WITH Auto Switch Mode and also applies only to the View mode.
I have read the English and German help again and cannot see this limitation. From the documentation and also from the configuration dialog you can clearly see that the "auto-run commands" belongs to the view modes -- independent from whether they are switched automatically or manually.
nsp wrote: 2022-05-21, 19:01 UTC Thanks for suggestion but my concern is to be able to enable/disable column or re-arrange on custom columns without affecting the definition.
Sorry for having "hijacked" your thread unintentionally by posting a suggestion. I will start new threads soon and leave this one for your initial question.
User avatar
white
Power Member
Power Member
Posts: 4594
Joined: 2003-11-19, 08:16 UTC
Location: Netherlands

Re: cm_100Percent <parameter>

Post by *white »

Moderator message from: white » 2022-05-22, 07:49 UTC

Posts above split from Better custom columns view.
User avatar
ghisler(Author)
Site Admin
Site Admin
Posts: 48021
Joined: 2003-02-04, 09:46 UTC
Location: Switzerland
Contact:

Re: cm_100Percent <parameter>

Post by *ghisler(Author) »

cm_100Percent 80 | cm_100Percent 70
Don't put a space after the parameter! There must be either a comma for the next command immediately, or the | separator, or the end of the command, e.g.
cm_100Percent 80|cm_100Percent 70
will work.
Author of Total Commander
https://www.ghisler.com
User avatar
tuska
Power Member
Power Member
Posts: 3741
Joined: 2007-05-21, 12:17 UTC

Re: cm_100Percent <parameter>

Post by *tuska »

2ghisler(Author)

Thanks! :)
I have unfortunately forgotten, as there must not be any spaces here "|". :(

 
2funkymonk
funkymonk wrote: 2022-05-22, 06:11 UTC > ... "The text in the help refers to a View mode WITH Auto Switch Mode and also applies only to the View mode." ...
I have read the English and German help again and cannot see this limitation.
From the documentation and also from the configuration dialog you can clearly see that the "auto-run commands"
belongs to the view modes -- independent from whether they are switched automatically or manually.
It is not a limitation (on the contrary), but I think we are talking at cross purposes here.

For me, the help text fits and if you have doubts:
"Here, TC's behaviour is not in line with the text in the help file: "Commands to run when the view mode changes."
then you can suggest an alternative text.

I suggest that we end our discussion here.

Regards,
Karl
User avatar
funkymonk
Senior Member
Senior Member
Posts: 410
Joined: 2013-12-04, 09:56 UTC

Re: cm_100Percent <parameter>

Post by *funkymonk »

ghisler(Author) wrote: 2022-05-22, 08:20 UTC
cm_100Percent 80 | cm_100Percent 70
Don't put a space after the parameter! There must be either a comma for the next command immediately, or the | separator, or the end of the command, e.g.
cm_100Percent 80|cm_100Percent 70
will work.
Thank you.

@ghisler
Can you please comment on the question whether auto-run commands should be executed when switching view modes manually?
(Just to know if the current behavior is intended or not -- and if the documentation is clear or not.)
Thank you.
User avatar
tuska
Power Member
Power Member
Posts: 3741
Joined: 2007-05-21, 12:17 UTC

Re: cm_100Percent <parameter> for "auto-run commands" in view modes

Post by *tuska »

Here's an example for "switching View modes manually":

Code: Select all

View Mode - title : <Standard> = <Default>; German: <Vorgabe>
Columns view .....: Full
Sort order .......: Name
-------------------------------------------------------------------------------------------------
View Mode - title : View-100pct_BUTTON
Auto-run commands : cm_VerticalPanels,cm_100Percent|em_Width_50Percent,cm_RereadSource 2
em_Width_50Percent: cm_VerticalPanels,cm_50Percent
-------------------------------------------------------------------------------------------------
BUTTON ...........: cm_SrcViewModeList View-100pct_BUTTON   <-- SWITCHING VIEW MODES MANUALLY <--
- 1st click ......: cm_VerticalPanels,cm_100Percent
- 2nd click ......: em_Width_50Percent,cm_RereadSource 2
Hopefully that clears up the last question.
Button (CODE) cm_SrcViewModeList View-100pct_BUTTON

Code: Select all

TOTALCMD#BAR#DATA
cm_SrcViewModeList View-100pct_BUTTON

wcmicons.dll,23
cm_SrcViewModeList View-100pct_BUTTON  ON/OFF|Auto-run commands: cm_VerticalPanels,cm_100Percent||em_Width_50Percent,cm_RereadSource 2|em_Width_50Percent: cm_VerticalPanels,cm_50Percent|https://ghisler.ch/board/viewtopic.php?t=76723 View modes manually


-1
usercmd.ini - for em_commands (required for button above...)

Code: Select all

[em_Width_50Percent]
button=
cmd=cm_VerticalPanels,cm_50Percent
Button (CODE) cm_SrcViewMode0  ... 8500 Source: Default view mode (no colors or icons) - etc.

Code: Select all

TOTALCMD#BAR#DATA
cm_SrcViewMode0,cm_SrcAllFiles,cm_50Percent,cm_RereadSource,cm_rereadsource 1

wcmicons.dll,86
cm_SrcViewMode0,cm_SrcAllFiles,cm_50Percent,cm_RereadSource,cm_rereadsource 1|View mode <Standard>: cm_SrcViewMode0|Active panel!|-|cm_RereadSource Ctrl+R|-|cm_rereadsource 1 )|cm_rereadsource 2 )|cm_rereadsource 3 ) <as of TC 9.50 --> see: HISTORY.TXT!>

0
-1
Create a Button in the Buttonbar (copy/paste CODE)
  1. Click on "SELECT ALL" (to the right of CODE:), then press CTRL+C (copy to clipboard).
  2. Right-click on any place in the button bar, then click on "Paste".
     ⸺⸺⸺⸺⸺⸺⸺⸺⸺⸺⸺⸺⸺⸺⸺⸺⸺⸺⸺⸺⸺⸺⸺⸺⸺
  3. Option1: Point to the new button (slightly longer): 'Tooltip' is shown (-> description to the button).
                  A maximum of 259 characters is allowed for the tooltip. | = create line break, || = create | as separator character.
  4. Option2: Button bar - "Tooltip" field: A single space deactivates the display of the tooltip.
                  If the "Tooltip" field is empty, the content of the "Command" field is displayed.
  5. Option3: See FAQs and explanation: Button-code (TOTALCMD#BAR#DATA)  <-- <Ctrl+click on the link...>

Overview: View Mode | Auto Switch Mode | Custom columns view
User avatar
funkymonk
Senior Member
Senior Member
Posts: 410
Joined: 2013-12-04, 09:56 UTC

Re: cm_100Percent <parameter> for "auto-run commands" in view modes

Post by *funkymonk »

Well, a question like „Can you please comment on the question whether auto-run commands should be executed when switching view modes manually?” can obviously not be answered by throwing in a some button code.

However, the commands you have used for defining your button helped me to trace down the problem – this might (1) solve a potential misunderstanding and (2) indicate a potential bug/inconsistency.

------

In fact, my question must be rephrased to: “Which commands will trigger the auto-run commands when switching view modes manually?”

Here is the catch:
In my configuration I use some user-defined short cuts

Code: Select all

C+1=cm_SrcLong
C+2=cm_SrcCustomView1
to switch between view modes.

SrcCustomView1 refers to a view mode named “ViewModeWithAutoRunCommands” with the auto-run commands

Code: Select all

cm_100Percent 80|cm_100Percent 60
However, neither cm_SrcCustomView1 nor cm_SrcLong do trigger these auto-run commands for CustomView1.
(I.e., cm_100Percent 80 is not executed when activating CustomView1 via Crtl+2, and cm_100Percent 50 is not activated when leaving CustomView1 to Long via Ctrl+1.)

If I reconfigure the short cuts to call user-defined commands that call cm_SrcViewModeList, like

Code: Select all

[em_ShowFileListDetails]
button=
cmd=cm_SrcViewModeList ViewModeWithAutoRunCommands

[em_ShowFileListLong]
button=
cmd=cm_SrcViewModeList 0
with

Code: Select all

C+1=em_ShowFileListLong
C+2=em_ShowFileListDetails
everything works well and the auto-run commands are triggered when activating or leaving the view mode.

------

Regarding (1) the potential misunderstanding: @tuska Perhaps we both focused too much on our respective methods/commands of switching view modes.

Regarding (2) the potential bug/inconsistency: I have not found anywhere (help file, history, command browser) that cm_SrcLong or SrcCustomView* do not trigger the auto-run commands -- but SrcViewModeList does. @ghisler Is this intentional? If so, a note in the help file would be helpful.
User avatar
ghisler(Author)
Site Admin
Site Admin
Posts: 48021
Joined: 2003-02-04, 09:46 UTC
Location: Switzerland
Contact:

Re: cm_100Percent <parameter> for "auto-run commands" in view modes

Post by *ghisler(Author) »

Can you please comment on the question whether auto-run commands should be executed when switching view modes manually?
(Just to know if the current behavior is intended or not -- and if the documentation is clear or not.)
They are run when you choose a view mode manually, e.g. by choosing menu Show - Custom view modes - your view mode.

As user funkymonk points out calling cm_SrcLong or cm_SrcCustomView1 does not cause a view mode switch, it only causes a switch of the columns type (full or custom columns). They were called "custom column views" before custom view modes were added, that's why the names are confusing.

When you use e.g. cm_SrcViewMode1 then it will apply your view mode AND execute the commands as expected.
Author of Total Commander
https://www.ghisler.com
User avatar
funkymonk
Senior Member
Senior Member
Posts: 410
Joined: 2013-12-04, 09:56 UTC

Re: cm_100Percent <parameter> for "auto-run commands" in view modes

Post by *funkymonk »

ghisler(Author) wrote: 2022-05-23, 08:30 UTC As user funkymonk points out calling cm_SrcLong or cm_SrcCustomView1 does not cause a view mode switch, it only causes a switch of the columns type (full or custom columns). They were called "custom column views" before custom view modes were added, that's why the names are confusing.

When you use e.g. cm_SrcViewMode1 then it will apply your view mode AND execute the commands as expected.
Thank you. That clarifies the behavior.

The command names for "custom column views" and the "view modes" are indeed confusing:
cm_SrcCustomView* switches columns in "custom column views"
cm_SrcViewMode* switches "view modes"

But ok, once you know it's fine. Thank you again (@ghisler, @tuska).
Post Reply