Open folder + select file

Discuss and announce Total Commander plugins, addons and other useful tools here, both their usage and their development.

Moderators: Hacker, petermad, Stefan2, white

Post Reply
LightGreen
Junior Member
Junior Member
Posts: 2
Joined: 2008-07-25, 18:24 UTC

Open folder + select file

Post by *LightGreen »

Hi everyone!

My respect goes to the author and all the community here!
I've got a rather specific question.
There are some programs which provide an "Open containing folder" context menu (download managers, for example). Is it possible to programmatically redirect (or re-implement) this action to a Total Commander instance?
I do not know if I need to write a plugin for that purpose, but how can this be achieved? My new project requires that I incorporate an "Open containing folder" feature for some arbitrary files. If Total Commander is found on the machine, then the target file must be selected in the active panel of the topmost Total Commander instance (just the same way like it is done in Explorer). The necessary change folder operation should be completed if the file path requires it.
Is there a way to do that, and if yes, then how can it be achieved?
I can rely on pure C++ and WinAPI wherever needed, but no managed code.
Thanks in advance. Hoping to hear from you soon.
Best regards,
Vitaly Demin aka LightGreen.

------------------------------------------------------------
Sometimes programming is hard, but it is rewarding.
User avatar
Hacker
Moderator
Moderator
Posts: 13142
Joined: 2003-02-06, 14:56 UTC
Location: Bratislava, Slovakia

Post by *Hacker »

Hello,
Explorer integration
:)

HTH
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.
LightGreen
Junior Member
Junior Member
Posts: 2
Joined: 2008-07-25, 18:24 UTC

Post by *LightGreen »

Hacker wrote:Hello,
Explorer integration
Thanks, that's great! So it is possible to run the total commander and make it open the desired folder. But the two problems still remain:
1) the folder gets open in the default panel (left or right), not the currently active panel
2) the file is not selected, like in "explorer /select, c:\windows\notepad.exe",

Could you please give me a clue how to do that :?:

Thanks,
Vitaly.
User avatar
Sombra
Power Member
Power Member
Posts: 814
Joined: 2005-12-27, 22:23 UTC
Location: Zaragoza, Spain

Post by *Sombra »

2LightGreen

A good explanation for command line parameters is in help file section 4-a.
the file is not selected, like in "explorer /select, c:\windows\notepad.exe",
Yes the file is not selected, but can be focused if you pass the full path with filename.
I can read English, but... I write like Tarzan. (sorry)
icfu
Power Member
Power Member
Posts: 6052
Joined: 2003-09-10, 18:33 UTC

Post by *icfu »

Yes the file is not selected, but can be focused if you pass the full path with filename.
The file is only focused if it's not a TC supported archive, either internally or by packer plugin, otherwise it is entered.

To prevent that, in case of a packer plugin extension, tweak the packer with Plugman – http://www.totalcmd.net/plugring/tc_plugman.html – uncheck "Don't open with Enter but with Ctrl PgDn". Manually subtracting 256 from the number in front of the packer in wincmd.ini also does the job.

If you want to select a file, this can be done with external scripting, AHK for example. If you wanna use C++, check that:
http://www.ghisler.ch/wiki/index.php?title=Addon_library

All you need is to do is to parse the directory from the given file path, then change directory in TC, then select the file by directly manipulating the TC listbox with LB_SETSEL.

Icfu
This account is for sale
User avatar
Sombra
Power Member
Power Member
Posts: 814
Joined: 2005-12-27, 22:23 UTC
Location: Zaragoza, Spain

Post by *Sombra »

The file is only focused if it's not a TC supported archive


Good point. I missed it with an anticipated result.
I can read English, but... I write like Tarzan. (sorry)
Post Reply