Multi Commander Support Forum

Multi Commander => Script => Topic started by: Bernd on November 22, 2020, 13:56:06

Title: Link to file in clipboard
Post by: Bernd on November 22, 2020, 13:56:06
I am trying to do the following thing. I copy a file with Ctrl+C (not necessarily in MC); then I navigate to a folder in MC, use a User Defined command (or something else) to create a lnk file to point to the file in the clipboard. But I don't know how to get the path to the file in the clipboard - GetClipboardText() doesn't do it. And I don't know how to create a lnk file pointing to that path.
Title: Re: Link to file in clipboard
Post by: AlanJB on November 22, 2020, 16:47:33
The clipboard does not exist as a file system object (like a file or folder) so you cannot link to it.

"The clipboard" is a memory object dynamically created as it is needed.
Title: Re: Link to file in clipboard
Post by: Bernd on November 22, 2020, 17:19:39
That‘s a misunderstanding. I don‘t want to link to the clipboard but I want to link to the file at the place where I copied it with Ctrl+C to the clipboard. Very much like you can Ctrl+C in Windows Explorer and then can create a link via the right click menu. Unfortunately it seems, MC can‘t do this out of the box.
Title: Re: Link to file in clipboard
Post by: AlanJB on November 23, 2020, 11:05:47
Yes - I misunderstood - sorry.
Title: Re: Link to file in clipboard
Post by: Matthias515566 on November 26, 2020, 03:12:50
i have a good solution for your Problem. Create a new "User Defined Command" and a Keyboard Shortcut to this command.

Code: [Select]
MC.Utils.CreateLink LNKSRC="${targetpath}${sourcefocusname}.lnk" LNKTRG="${focusfilepath}" LNKTYPE=4
This create a new shortcut in the Target Panel, but this works only for one file, not for multiple files. maybe somebody have a solution for multiple files and folders?