Multi Commander > Support and Feedback

Copy path with spaces

(1/2) > >>

Bernd:
When I have a path "c:\Black and White" and copy it with Ctrl+P, MC copies it as it is, but I would like to have the spaces replaced with %20. Otherwise some programs don't recognize the complete path but stop after c:\Black. Is there a way to achieve this?
Best regards, Bernd

Mathias (Author):
There is no built in function for that. But you can create you own UserDefinedCommand using MultiScipt

There are functions for getting name of selected files , replacing text in string for settings text to the clipboard.

http://multicommander.com/docs/UDC_multiscript
http://multicommander.com/docs/multiscript/functions/getfilefromview#getselectedfilenames
http://multicommander.com/docs/multiscript/functions/string#strreplace
http://multicommander.com/docs/multiscript/functions/misc#setclipboardtext



Matthias515566:
copy your paths to excel or a text editorand use Search and Replace to change the Space with your old school HTML "%20".

Mathias (Author):
create a UserDefinedCommand of MultiScript Type

insert this script code

--- Code: ---@var $names = GetSelectedFileNames();
@var $count = arrayCount($names)
for($idx = 0; $idx < $count; $idx++)
{
   $names[$idx] = StrReplace($names[$idx], " ", "%20");
}

@var $text = ArrayToString($names, "\r\n", 0 );
SetClipboardText($text);

--- End code ---

Save it, and assign a hotkey or add it to the menu.

Mathias (Author):
Or we can do it even more efficent


--- Code: ---@var $text = ArrayToString(GetSelectedFileNames(), "\r\n", 0 );
$text = StrReplace($text, " ", "%20");
SetClipboardText($text);
--- End code ---

Navigation

[0] Message Index

[#] Next page

Go to full version