ViewMode onExit commands

Here you can propose new features, make suggestions etc.

Moderators: white, Hacker, petermad, Stefan2

Post Reply
User avatar
nsp
Power Member
Power Member
Posts: 1805
Joined: 2005-12-04, 08:39 UTC
Location: Lyon (FRANCE)
Contact:

ViewMode onExit commands

Post by *nsp »

When you define viewmode, you have a autorun command that is excuted when the viewmode is loaded.

If we add some command to turn some feature on or load some specific toolbar,.... , hide

Could it be possible to have an autoExit command to turn it off when you switch to other viewmode or default..
User avatar
petermad
Power Member
Power Member
Posts: 14808
Joined: 2003-02-05, 20:24 UTC
Location: Denmark
Contact:

Post by *petermad »

Support +++
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
ghisler(Author)
Site Admin
Site Admin
Posts: 48083
Joined: 2003-02-04, 09:46 UTC
Location: Switzerland
Contact:

Post by *ghisler(Author) »

I would prefer not to add another line to this page, but maybe I could integrate it somehow with the current user interface, e.g.
cm_command1, cm_command2 | com_command3, cm_command4

What do you think?
Author of Total Commander
https://www.ghisler.com
User avatar
petermad
Power Member
Power Member
Posts: 14808
Joined: 2003-02-05, 20:24 UTC
Location: Denmark
Contact:

Post by *petermad »

So yo mean that what comes after | will be executed when leaving the View Mode...?

If you do it that way, we will have to answer questions about how to do this here in the forum for years to come - you no how people don't read the help ;-)

But I also understand that another field requires translation, which might postpone the final release.
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
nsp
Power Member
Power Member
Posts: 1805
Joined: 2005-12-04, 08:39 UTC
Location: Lyon (FRANCE)
Contact:

Post by *nsp »

ghisler(Author) wrote:I would prefer not to add another line to this page, but maybe I could integrate it somehow with the current user interface, e.g.
cm_command1, cm_command2 | com_command3, cm_command4

What do you think?
Having a separator on the same field could be a good idea you could resize it (at least 3 times) or have two lines.

IMHO It is clearer to have two separate auto-run field.
User avatar
ghisler(Author)
Site Admin
Site Admin
Posts: 48083
Joined: 2003-02-04, 09:46 UTC
Location: Switzerland
Contact:

Post by *ghisler(Author) »

There is another problem: I can catch the directory change only when it is already complete. This would mean that the commands would be executed when already in the new directory. Probably not what the user would expect. :(
Author of Total Commander
https://www.ghisler.com
User avatar
Balderstrom
Power Member
Power Member
Posts: 2148
Joined: 2005-10-11, 10:10 UTC

Post by *Balderstrom »

So basically there needs to be a way to indicate something should occur when the tab becomes inactive by switching to another tab in the same panel - like a reset.
  1. cm_cmd1,cm_cmd2##cm_cmd2ToRunWhenInactiveSuchAsWhenChangingTabs,cmd3
  2. cm_cmd1,cm_cmd2#cm_cmd2ToRunWhenInactiveSuchAsWhenChangingTabs,cmd3
  3. cm_cmd1,cm_cmd2$cm_cmd2ToRunWhenInactiveSuchAsWhenChangingTabs,cmd3
  4. cm_cmd1,cm_cmd2$$cm_cmd2ToRunWhenInactiveSuchAsWhenChangingTabs,cmd3
I use "$" in this example, as "$" is used in Regex to denote the end of a line. So just prior to changing tabs, "cm_cmd2ToRunWhenInactiveSuchAsWhenChangingTabs" will be run.

So one would need to keep track of which actions were defined to occur at this "interrupt" stage - prior to switching tabs. Then maybe a do a sanity-check to make sure the tab actually changed - if not, re-run cm_cmd_1,cmd2$$cm_...


[Aside]:
I would also like to point out that "|" is already used in many other places within TC's various settings, dialogs, tool bars, etc.
*BLINK* TC9 Added WM_COPYDATA and WM_USER queries for scripting.
User avatar
nsp
Power Member
Power Member
Posts: 1805
Joined: 2005-12-04, 08:39 UTC
Location: Lyon (FRANCE)
Contact:

Post by *nsp »

ghisler(Author) wrote:There is another problem: I can catch the directory change only when it is already complete. This would mean that the commands would be executed when already in the new directory. Probably not what the user would expect. :(
Anyway this should run when you leave the viewmode and before switching to new directory. This should also occurs even if the viewmode is changed manually or using a command on the same folder.
Basically you have to detect if you change ViewMode by a command of if the change to a new directory will trigger a ViewMode change once the folder will be set. This is probably not the way you implemented the Auto-switch :(
You know the pattern for the current viewmode so you ca detect before doing a CD if you leave or not the current mode.
User avatar
ghisler(Author)
Site Admin
Site Admin
Posts: 48083
Joined: 2003-02-04, 09:46 UTC
Location: Switzerland
Contact:

Post by *ghisler(Author) »

Anyway this should run when you leave the viewmode and before switching to new directory.
Unfortunately this is impossible because TC cannot know whether leaving a directory will be successfull, e.g.
1. User tries FTP connection, but it fails
2. User tries to switch to inaccessible drive
etc.
Author of Total Commander
https://www.ghisler.com
macleod
Junior Member
Junior Member
Posts: 48
Joined: 2016-06-12, 07:32 UTC

Post by *macleod »

But you know from which directory you came and can execute command with previous directory as a parameter. But it depends on used command ...
User avatar
Balderstrom
Power Member
Power Member
Posts: 2148
Joined: 2005-10-11, 10:10 UTC

Post by *Balderstrom »

ghisler(Author) wrote:
Anyway this should run when you leave the viewmode and before switching to new directory.
Unfortunately this is impossible because TC cannot know whether leaving a directory will be successfull, e.g.
1. User tries FTP connection, but it fails
2. User tries to switch to inaccessible drive
etc.
When the switch to a new directory|or tab fails, just re-run the viewMode?

1) Run any onExit(ViewMode) actions.
2) Attempt to open the Folder.
3) If the path has not changed, Re-run the ViewMode.
4) If the path has changed, Clear the ViewMode.

EDIT:
* I don't think the "Refresh" Boolean I mentioned previously is needed.
Last edited by Balderstrom on 2016-07-30, 03:56 UTC, edited 3 times in total.
*BLINK* TC9 Added WM_COPYDATA and WM_USER queries for scripting.
User avatar
petermad
Power Member
Power Member
Posts: 14808
Joined: 2003-02-05, 20:24 UTC
Location: Denmark
Contact:

Post by *petermad »

When the switch to a new directory|or tab fails, just re-run the viewMode?
Sounds feasible...
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