Page 1 of 1
ViewMode onExit commands
Posted: 2016-06-27, 17:10 UTC
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..
Posted: 2016-07-25, 09:03 UTC
by petermad
Support +++
Posted: 2016-07-25, 09:28 UTC
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?
Posted: 2016-07-25, 09:55 UTC
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.
Posted: 2016-07-26, 06:25 UTC
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.
Posted: 2016-07-27, 20:29 UTC
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.

Posted: 2016-07-28, 05:35 UTC
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.
- cm_cmd1,cm_cmd2##cm_cmd2ToRunWhenInactiveSuchAsWhenChangingTabs,cmd3
- cm_cmd1,cm_cmd2#cm_cmd2ToRunWhenInactiveSuchAsWhenChangingTabs,cmd3
- cm_cmd1,cm_cmd2$cm_cmd2ToRunWhenInactiveSuchAsWhenChangingTabs,cmd3
- 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.
Posted: 2016-07-28, 11:48 UTC
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.
Posted: 2016-07-29, 09:48 UTC
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.
Posted: 2016-07-30, 01:27 UTC
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 ...
Posted: 2016-07-30, 02:43 UTC
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.
Posted: 2016-07-30, 02:47 UTC
by petermad
When the switch to a new directory|or tab fails, just re-run the viewMode?
Sounds feasible...