Selected file/folder-path to memory (filemapping)

Here you can propose new features, make suggestions etc.

Moderators: white, Hacker, petermad, Stefan2

dragonetti
Junior Member
Junior Member
Posts: 33
Joined: 2007-07-09, 21:03 UTC

Selected file/folder-path to memory (filemapping)

Post by *dragonetti »

Within the windows API you have the commands:
MapViewOfFile
OpenFileMappingW
CreateFileMappingW

If I am not mistaken it writes data into a certain part of the memory.

Could it be made possible to have an option within totalcommander that writes the currently selected file/folder-path to the memory but in a way so that it is stored in reachable way for the user, the above windows api commands are an example of how it could be implemented using thos commands. I am not stating it should be done using that within tcmd, it is just for example purposes.

This might open an easier way for users to execute something based on the selected file/folder under the cursor.

What follows now is not really important but might give you a better idea of what I mean.
Below follows an explanation about the 'filemapping' used in my case/environment. It just gives an example of what I mean.

Regarding the below image 'tcmd_request.jpg':
On the leftside within the black rectangle you see 2 code parts (process A and process B) when the code is executed the code under Process A writes '5' to the memory.

The code under process B reads that memory section and outputs it.
(The 'out' command, outputs.)

On the rightside the content of the 2 functions 'Create' and 'Open' is shown.

Image: https://image.ibb.co/fZUHRT/tcmd_request.jpg

So the idea is to write the selected file/folder to memory and then the user could act upon it using his own scripting environment.

It is not easy for me to explain because I have no C++/C# experience but many environments allow usage of 'memory filemapping' I was hoping it could be implemented within tcmd.
User avatar
Horst.Epp
Power Member
Power Member
Posts: 6449
Joined: 2003-02-06, 17:36 UTC
Location: Germany

Post by *Horst.Epp »

I guess Christian and no other File manager author will do so.
Memory mapped filesd are not necessary at all
to interface your own scripts with TC.
Also for me its totaly unclear why you want to use such environment
if you don't have any C++/C# experience.
Windows 11 Home x64 Version 23H2 (OS Build 22631.3374)
TC 11.03 x64 / x86
Everything 1.5.0.1371a (x64), Everything Toolbar 1.3.2, Listary Pro 6.3.0.69
QAP 11.6.3.2 x64
User avatar
Stefan2
Power Member
Power Member
Posts: 4132
Joined: 2007-09-13, 22:20 UTC
Location: Europa

Post by *Stefan2 »

2dragonetti

We can exchange information with TC by utilizing the Clipboard, a temporarily file or SendMessage action.

TC support us by providing parameters for current and target paths and a list with path\names of selected files and folders.

We can use script languages like JavaScript, VBScript, PowerShell or tools like AutoHotkey, AutiIt, PowerPro or NirSofts' nircmd or tools like MVVs' TCFS2.

See http://www.ghisler.ch/wiki/index.php/Scripting_utilities




Plugin-authors have even better possibilities to control TC.
https://www.ghisler.ch/wiki/index.php?title=Plugin
https://www.ghisler.ch/wiki/index.php?title=List_of_64-bit_plugins_and_addons






 
Last edited by Stefan2 on 2018-05-22, 18:24 UTC, edited 1 time in total.
User avatar
MVV
Power Member
Power Member
Posts: 8702
Joined: 2008-08-03, 12:51 UTC
Location: Russian Federation

Post by *MVV »

TC is not a RAM disk driver to allow keeping files in memory, and mapping API doesn't allow accessing files by another programs in any way, mapping is only used for reading/writing within one process.

Also I can't imagine that accessing files from memory of another process may be easier than reading them from disk...
User avatar
Hacker
Moderator
Moderator
Posts: 13052
Joined: 2003-02-06, 14:56 UTC
Location: Bratislava, Slovakia

Post by *Hacker »

I guess dragonetti would simply like to use a RAM disk program?

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.
dragonetti
Junior Member
Junior Member
Posts: 33
Joined: 2007-07-09, 21:03 UTC

Post by *dragonetti »

I did not request that the contents of a file or folder is placed in the memory. I requested that the selected file/folder path is placed in an accessible part of the memory.

For example, the user selects (left clicks) on the folder: "d:\mp3" in the left pane then the the path (NOT contents) will be written into an accessible part of the memory. Based on that path certain action could be taken.

I stated that I do not have C#/C++ experience BUT I also stated that other environments allow usage of the windows API functions I stated in the beginning of my post. See also image I posted, it gives me the option to use those API functions, but those where just examples.

Again, the idea is:
- User left clicks a path (file/folder) in left or right pane.
- tcmd puts cursor on it
- tcmd writes somewhere in memory the selected file/folder path (NOT contents).
- finally, user could trigger one or more actions based on that path

I know this is a very specific request.
Last edited by dragonetti on 2018-05-22, 20:53 UTC, edited 1 time in total.
User avatar
Dalai
Power Member
Power Member
Posts: 9364
Joined: 2005-01-28, 22:17 UTC
Location: Meiningen (Südthüringen)

Post by *Dalai »

2dragonetti
Since you've been a forum user for many years, I suspect you know about the %L, %WL and similar parameters in the button bar and TC start menu. What I don't understand is how your suggestion is different from those parameters and why you don't want or can't use them. Could you elaborate on this, please?

Regards
Dalai
#101164 Personal licence
Ryzen 5 2600, 16 GiB RAM, ASUS Prime X370-A, Win7 x64

Plugins: Services2, Startups, CertificateInfo, SignatureInfo, LineBreakInfo - Download-Mirror
dragonetti
Junior Member
Junior Member
Posts: 33
Joined: 2007-07-09, 21:03 UTC

Post by *dragonetti »

@Dalai
The %.. parameters passes arguments to specific scripts/executables/applications...etc when you click on that button on which you assigned those arguments.

But how could I for example, execute an action the moment an .jpg file is left clicked. Or execute an action when a file or folder within "d:\mp3" is left clicked.

For that you need the full path of the current item under the cursor.
(selected file/folder in left or right pane).
User avatar
Dalai
Power Member
Power Member
Posts: 9364
Joined: 2005-01-28, 22:17 UTC
Location: Meiningen (Südthüringen)

Post by *Dalai »

dragonetti wrote:The %.. parameters passes arguments to specific scripts/executables/applications...etc when you click on that button on which you assigned those arguments.
Correct.
But how could I for example, execute an action the moment an .jpg file is left clicked. Or execute an action when a file or folder within "d:\mp3" is left clicked.
To save one click? Uh, OK... You're one of the lazy ones like me, eh ;)? Can't imagine a scenario where this would be useful, but I probably lack imagination. So WM_COPYDATA wouldn't be of any use either. Hm.

Regards
Dalai
#101164 Personal licence
Ryzen 5 2600, 16 GiB RAM, ASUS Prime X370-A, Win7 x64

Plugins: Services2, Startups, CertificateInfo, SignatureInfo, LineBreakInfo - Download-Mirror
User avatar
Hacker
Moderator
Moderator
Posts: 13052
Joined: 2003-02-06, 14:56 UTC
Location: Bratislava, Slovakia

Post by *Hacker »

dragonetti,
Would the clipboard suffice?

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
Stefan2
Power Member
Power Member
Posts: 4132
Joined: 2007-09-13, 22:20 UTC
Location: Europa

Post by *Stefan2 »

dragonetti wrote:I did not request that the contents of a file or folder is placed in the memory. I am requested that the selected file/folder path ....
Clear, anyway.


dragonetti wrote:...placed in an accessible part of the memory....
Latest since VistaTM, a user has no access to memory anyway, isn't it?




 
dragonetti
Junior Member
Junior Member
Posts: 33
Joined: 2007-07-09, 21:03 UTC

Post by *dragonetti »

@hacker, clipboard would not suffice because it needs to happen the moment the user left clicks in left or right pane. The path (not contents) of the selected file/folder would then be written into the memory (certain location) which could be accessible by the user if the path was written using for example the API commands I stated in my first post. (those where just examples). I think using clipboard for this, is not the best approach when compared to filemapping method. I think the filemapping method works faster (not 100% sure).

@Stefan2
You can have access to the memory as long data is written in such a way so that it is meant to be read. That's why I gave the above 3 api commands as an example. If you write the path in that way into the memory and document that the left clicked path is written at "this memory location" then the only thing the user has to do is access that location. With "this memory location" I am referring to the API commands I stated in my opening post.

The reason why I choose those commands because they are windows API commands which can be used in many environments, for example AHK and Autoit can use the windows API. I am not 100% sure of this but I am almost sure of it. If I am not mistaken tcmd is written in Delphi Lazarus and I read that Delphi can use the windows API. But I am not 100% sure of this and even if this is or is not the case, the commands I showed where an example.

It boils down to quickly read the left clicked item (in left or right pane, which could be file or folder). Using a method that is reasonably fast and usable in many environments. And then triggering action(s) on that left clicked path. (left clicked path = the left clicked item in the left or right pane).
User avatar
Hacker
Moderator
Moderator
Posts: 13052
Joined: 2003-02-06, 14:56 UTC
Location: Bratislava, Slovakia

Post by *Hacker »

dragonetti,
it needs to happen the moment the user left clicks in left or right pane
Seems to work quite acceptably:

Code: Select all

#IfWinActive, ahk_class TTOTAL_CMD
LButton::
	Click
	PostMessage, 1075, 2018
Return
Roman
Last edited by Hacker on 2018-05-22, 23:28 UTC, edited 1 time in total.
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.
dragonetti
Junior Member
Junior Member
Posts: 33
Joined: 2007-07-09, 21:03 UTC

Post by *dragonetti »

@hacker
Thank you for the example but the action needs to be based on the full path of the file/folder clicked upon not just the the left click itself. (I also do not use AHK, but I mentioned it as an example).

So for example, user left clicks on "test.mp3" in the left pane which is in "d:\mp3" then the full path get's written into the memory "d:\mp3\test.mp3" now that I have the full path on which is left-clicked then I can decide what action I want to perform based on that path (d:\mp3\test.mp3) which I grabbed from the memory.
User avatar
Hacker
Moderator
Moderator
Posts: 13052
Joined: 2003-02-06, 14:56 UTC
Location: Bratislava, Slovakia

Post by *Hacker »

dragonetti,
Well, using the example script above, upon clicking on some file in TC its full path gets loaded into the clipboard and then you can decide what action you want based on that path. Just grab it from the clipboard.

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.
Post Reply