to URL encode selected file and paste to clipboard.
Also prefix the string by "smb:"
Gauner wrote: Ich möchte mit List2Clip gern den URI-Identifier der markierten Dateien erzeugen, mit vorangestelltem smb: und URL-kodierten Zeichen.
Habe jetzt folgende Zeile gemacht:
%COMMANDER_PATH%\plugins\Lst2Clip.exe /U /P:"smb:" /R:""="/" /R:"+"="%2B" /R:" "="+" /R:"?"="%3F" /R:"="="%3D" /R:"%"="%%" /R:"&"="%26"
/R:"Ä"="%C3%84" /R:"Ö"="%C3%96" /R:"Ü"="%C3%9C" /R:"ß"="%C3%9F" /R:"ä"="%C3%A4" /R:"ö"="%C3%B6" /R:"ü"="%C3%BC" /R:"ẞ"="%E1%BA%9E"
Here is an solution utilizing PowerShell.
Please try and report back how it works for you.
Save the code to TC folder as file named f.ex.: cm_CopyURINamesToClip.ps1
-
Create an button or user defined command (usercmd.ini)
Command = PowerShell -NoProfile -NoExit -ExecutionPolicy Bypass
or just
Command = PowerShell
Parameter = "D:\rive\path\to\cm_CopyURINamesToClip.ps1" """%P%N"""
or more portable
Parameter = "%COMMANDER_PATH%\CMDs\cm_CopyURINamesToClip.ps1" """%P%N"""
(Yes, three double-quotes before and after %P%N !!!)
-
Select a file, click the button, and paste URI string where you want.
EXAMPLES:
Code: Select all
C:\ToCo9\plugins\lst2clip\liesmich-lst2clip_1_02.htm.TXT
C%3A%5CToCo9%5Cplugins%5Clst2clip%5Cliesmich-lst2clip_1_02.htm.TXT
X:\In_Arbeit\OceanViewer_1.2.3\Workinstruction.TXT
%5C%5CShare.Company.World.net%5CWork%5CIn_Arbeit%5OceanViewer_1.2.3%5CWorkinstruction.TXT
The PoSh code to save:
cm_CopyURINamesToClip.ps1
Code: Select all
# cm_CopyURINamesToClip.ps1
# Stefan, 2017.06.16a
# Found at: https://ghisler.ch/board/viewtopic.php?p=329427#329427
# Total Commander Button code:
# Command : PowerShell -NoProfile -NoExit -ExecutionPolicy Bypass
# Argument: "D:\rive\path\to\cm_CopyURINamesToClip.ps1" """%P%N"""
# Argument: "%COMMANDER_PATH%\TOOLs\CMDs\cm_CopyURINamesToClip.ps1" """%P%N"""
# (Yes, three double-quotes before and after %P%N !!!)
$Prefix = "smb:"
$Suffix = ""
$curITEM = $args[0] # due to TC's """%P%N""" ==> current selected item in TC
$currDRV = Split-Path -qualifier $curITEM
$locDISK = Gwmi Win32_LogicalDisk -filter "DriveType = 4 AND DeviceID = '$currDRV'"
$outPATH = $curITEM.Replace($currDRV, $locDISK.ProviderName)
If ($outPATH[1] -ne '\'){$outPATH = $curITEM} # on error use input as output
# To replace " " with %20 and / with %2F and so on, converts all odd characters in the supplied string:
$outPATH = [uri]::EscapeDataString($outPATH)
# If you want to do escaping for URLs only, This will leave, e.g., slashes (/) or equal signs (=) as they are.
#$outPATH = [uri]::EscapeUriString($outPATH)
$outPATH = $Prefix + $outPATH + $Suffix
#Set to clipboard:
$outPATH | clip.exe
HTH?
- - -
Find me:
cm_Copy em_Copy Copy Name To at Clip Clipboard
cm_Kopie em_Kopie Kopie Name ins in das zum Clip Clipboard