Basic operation hooks

Here you can propose new features, make suggestions etc.

Moderators: Hacker, petermad, Stefan2, white

Post Reply
nk
Junior Member
Junior Member
Posts: 13
Joined: 2009-09-15, 01:09 UTC
Location: Berlins Rockzippel

Basic operation hooks

Post by *nk »

For those users, who can't program their own Plugins in C, it might be a good idea, to create some hooks into TC, that can trigger batch code or operations.

An example:

I wished, there was an option to sync directory changing operations of both windows. Imagine, there were two folder structures, that I want to compare or synchronize by copying some of their files in different subfolders from one to each other:

Code: Select all

d:\projects\projectxy
  + abc
  + cde
     + def
        + ghi

Code: Select all

e:\development\0901\projectxy
  + abc
  + cde
     + def
        + ghi
So it would be nice to have a feature, that syncs the operations of dir changings, if possible.

BUT

This example is much to particular, to suggest it as a basic feature. So the better option would be, to have a feature to create hooks, eg. - in this case - for the operations onChangeDirUp and onChangeDirDown.
Every time this event would happen, TC would look for Actions that are linked to this event.

According to the principle at settings dialog for button bar commands there could be the path / parameter - input, to set up external batchfiles, but comands like cm_GoToRoot as well.

In my case I would check the drives and directories of source and target window, if they have the same path relative to a defined root path. Lets say, the Action onChangeDirDown would be triggered before dir-changing but the command would be executed after the changing. Then you could execute cd.. to undo dir changing into the subfolder, if no equivalent folder exists in the target window, otherwise you would set the target window path to the new path part relative to its drive. Are you still with me? :)

Maybe a easier example:

Imagine, there was an hook "onChangeDrive". You could create a Batchfile, that checks the source drive letter. If it is T:, the Batch starts a command to set the target window into tree view mode.

Or:

onConnectFTP perform: change path of the target window to d:\projects\upload

Or:

onExitTotalCommander perform: trigger my versioning control system to commit files in a given path

Or:

onZipDone perform: create a hash of this zip an write it into a text file.



So here's my request:

It would be nice to have an Option to define Commands/Scripts/Batches on defined events. Events might be changing directories/drives, open/close connections/application ...
Then, there would be an action input for TC-commands or external executables, an parameter input that supports the known things like %T for target window and a setting, that says, when the batch is called (before/after event).

Simple, is'nt it?
User avatar
Hacker
Moderator
Moderator
Posts: 13142
Joined: 2003-02-06, 14:56 UTC
Location: Bratislava, Slovakia

Post by *Hacker »

nk,
Nice idea, some of it can already be done using AHK for instance.
An example:

I wished, there was an option to sync directory changing operations of both windows.
For that we already have cm_SyncChangeDir.

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
Balderstrom
Power Member
Power Member
Posts: 2148
Joined: 2005-10-11, 10:10 UTC

Post by *Balderstrom »

Most of that can be accomplished by writing a batch that
does action1, then action2 when action1 is complete.
And some of it could be scripted in AutoHotKey, as TC has a slew of "triggers" and notifications that it bandies about that can readily be hooked into.

You can easily trigger on clicking on a folder, checking which folder that is, whether FTP is active, etc etc.

Any trigger system that was so basic that anyone without any gumption at all to bother learning HOW to do something would be next to useless for doing much at all as it would be hobbled out of the box. And each and every little minor thing would require a change by the Author (Mr.Ghisler) - whereas we have any number of Scripting languages that can do innumerous things with TC, AutoIT, AutoHotKey, PowerPro and even .cmd batch files themselves to some extent -- which can be interfaced with the aforementioned scripts.
*BLINK* TC9 Added WM_COPYDATA and WM_USER queries for scripting.
User avatar
MVV
Power Member
Power Member
Posts: 8711
Joined: 2008-08-03, 12:51 UTC
Location: Russian Federation

Post by *MVV »

I'm afraid that if you will execute batch file on each triggered event, your TC will operate slow like turtle. Starting external EXE is very slow in this case. Starting external command interpreter with batch file is much slower. And, BTW, there is no way to change dir (for example) in TC from external batch file. So, you need a great script language support by TC in order to realize your wish. But this task requires a lot of work and code.
nk
Junior Member
Junior Member
Posts: 13
Joined: 2009-09-15, 01:09 UTC
Location: Berlins Rockzippel

Post by *nk »

For that we already have cm_SyncChangeDir.
Ah, thx. See Topic #185540 (Sorry can't post Links today)
User avatar
Balderstrom
Power Member
Power Member
Posts: 2148
Joined: 2005-10-11, 10:10 UTC

Post by *Balderstrom »

Change dir from external batch file:
SET newDir="C:\Some\Path"
START "" "%Commander_Path%\TotalCMD.exe" /O /L="%newDir%"
What slows my TC down is attempting to do anything from \\My Documents or \\Desktop.
Scripts hardly slow TC down in the least. I should know, I even have my Mouse Left/Right click scripted and excepted.
neverthelesshello
Member
Member
Posts: 136
Joined: 2010-02-26, 11:52 UTC

Post by *neverthelesshello »

hmm well I wish TC had scripting capabilities like XYplorer
What you dont see is what you get!
User avatar
Balderstrom
Power Member
Power Member
Posts: 2148
Joined: 2005-10-11, 10:10 UTC

Post by *Balderstrom »

I sometimes think scripting in TC would be "good" -- but then it's just another language to learn.

And neither XYPlorer's nor FileBoss' internal scripting language were particularly good when compared to AHK and/or Windows Command shell or even WSH or others.

It would be nice if TC had a more userfriendly way to hook in from AHK or CMD.exe though and a few more actionable internal commands.
*BLINK* TC9 Added WM_COPYDATA and WM_USER queries for scripting.
User avatar
JohnFredC
Power Member
Power Member
Posts: 886
Joined: 2003-03-14, 13:37 UTC
Location: Sarasota Florida

Post by *JohnFredC »

I think the Salamander and SpeedCommander scripting paradigms would be good to emulate. The user is not locked into a particular scripting language and the hooks are well documented.

Those tools provide default UI-supported (i.e., internal) tools to directly edit/run scripts from dedicated menu items and to assign scripts to controls in the UI.

Of course, one can do this in TC already, but with more effort on the user's part: an assemblage of individual pieces "from the outside": editor, files, custom menu items/buttons/hotkey assignments. There are both advantages and disadvantages to this approach. TC's approach is more flexible if the user is comfortable with providing all of the integration effort.

But the advantage to a script development environment integrated natively into TC itself is shown by the SC approach. The SC scripting environment has Intellisense, a boon for beginners and experienced programmers, alike. The entire SC programming model of objects, properties, and methods is available in the script editor itself.

Works great!
Licensed, Mouse-Centric, moving (slowly) toward Touch-centric
Post Reply