Copy file path or file name to clipboard

English support forum

Moderators: white, Hacker, petermad, Stefan2

Post Reply
DaveBoltman
Junior Member
Junior Member
Posts: 3
Joined: 2007-12-11, 20:29 UTC

Copy file path or file name to clipboard

Post by *DaveBoltman »

Hi all,

Sort of searched the forums, but havent found the answer yet. Is there a way in TC to (quickly) copy the path and file name of a selected file or folder to the clipboard? This makes it easy to paste a filename (with path) when (eg) attaching files to an email, or any situation where a click on a file is not enough to do what you want to do - attach a database file to a SQL server etc etc etc

You can press Ctrl-Shift-Enter to add the path and file name of a selected file into the command box at the bottom of TC. Then you still have to select it and press Ctrl-C to copy it. To copy another file's path, you have to first erase the command box, then Ctrl-Shift-Enter, then select it, copy it. Way too slow. Could there be a simple menu command or hotkey to do this?

Thanks
Dave
User avatar
Stitscher
Power Member
Power Member
Posts: 1058
Joined: 2004-02-17, 12:34 UTC
Location: Hamburg, Germany

Post by *Stitscher »

Did you check the entry "Mark" in the Menu?

Commands:
cm_CopyNamesToClip
cm_CopyFullNamesToClip

Stitscher
DaveBoltman
Junior Member
Junior Member
Posts: 3
Joined: 2007-12-11, 20:29 UTC

Post by *DaveBoltman »

Sheesh - silly me

Thanks!!!!

TC Rules!!
CDR
Junior Member
Junior Member
Posts: 19
Joined: 2006-07-01, 23:26 UTC

Post by *CDR »

:idea:

My idea is an icon that copy the path (suggestion TC 7.03)
http://www.geocities.com/cdavidrp/images/copyPath.gif
Last edited by CDR on 2007-12-11, 21:38 UTC, edited 1 time in total.
User avatar
Stitscher
Power Member
Power Member
Posts: 1058
Joined: 2004-02-17, 12:34 UTC
Location: Hamburg, Germany

Post by *Stitscher »

CDR wrote::idea:

My idea is an icon that copy the path
http://www.geocities.com/cdavidrp/images/copyPath.gif
You can make your own icons in the buttonbar. What is wrong with that?

Stitscher
User avatar
Hacker
Moderator
Moderator
Posts: 13052
Joined: 2003-02-06, 14:56 UTC
Location: Bratislava, Slovakia

Post by *Hacker »

[mod]Moved to the English forum.

Hacker (Moderator)[/mod]
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.
sorcar
Member
Member
Posts: 100
Joined: 2005-04-12, 17:45 UTC
Location: U.S.

Post by *sorcar »

I have to copy filenames and filepaths very often. I made the following associations through Configuration/Option/Misc/Hotkey:

cm_CopyNamesToClip with F11
cm_CopyFullNamesToClip with F12

This gives me one tap access to copying to clipboard one file or any number of files I have selected. This is fast convenient. Of course you can associate any number of other key combinations to suite your preference.
User avatar
Clo
Moderator
Moderator
Posts: 5731
Joined: 2003-12-02, 19:01 UTC
Location: Bordeaux, France
Contact:

Buttons---

Post by *Clo »

2DaveBoltman

:) Hello !

• The Stischer's (menu) and sorcar's (keys) solutions are nice, but since you wish icons,
you could set three buttons in the button-bar like I use here with the commands :
cm_CopyNamesToClip
cm_CopyFullNamesToClip
cm_CopyNetNamesToClip

- A small ZIP containing three meaningful icons is available HERE (24² with pastel BGs, could do the trick to test…)

:mrgreen: KR
Claude
Clo
#31505 Traducteur Français de TC French translator Aide en Français Tutoriels Français English Tutorials
parakovsky
Junior Member
Junior Member
Posts: 7
Joined: 2016-09-20, 07:19 UTC

Post by *parakovsky »

cm_CopyFullNamesToClip - is great, but what to modify if we only need last two directories in a given path, for ex: C:/folder/folder1/file.ext

we just need folder1/file.ext for our purpose, am sure it can be done, but how?
User avatar
Stefan2
Power Member
Power Member
Posts: 4133
Joined: 2007-09-13, 22:20 UTC
Location: Europa

PowerShell:cm_CopyFullNamesToClip but only parts of the path

Post by *Stefan2 »

parakovsky wrote:we just need folder1/file.ext for our purpose, am sure it can be done, but how?
We have to utilize a external tool to modify the strings of each path.


For both examples use a tool like PowerShell, VBS or AHK to manipulate the file or clipboard content.


Example 1:
- use TCs %L parameter to save the name of selected files to a temporary file.
- use a scripting tool to manipulate that file
- copy the file content to the clipboard
Here is one of many post about that: http://ghisler.ch/board/viewtopic.php?p=291870#291870


Example 2:
- utilize cm_CopyFullNamesToClip
- manipulate the clipboard directly by using a scripting tool
Here is one of many post about that: http://www.ghisler.ch/board/viewtopic.php?t=29019



For both ways you can create buttons and/or keyboard shortcuts toexecute.



If there is an interest for this, maybe someone can point you to the right direction.


EDIT (lunch break :wink: )

for ex:
FROM:
C:\folder\folder1\file.ext
TO:
\folder1\file.ext

USE TC Button Setting:
CMD : PowerShell
PARA: TYPE '%L'|Foreach{$_ -Replace('^.+(\\.+?\\.+)$','$1')}|clip




Or rather for your FTP case with forward slashes:

FROM:
C:/folder/folder1/file.ext
TO:
/folder1/file.ext

TYPE '%L'|Foreach{$_ -Replace('^.+(/.+?/.+)$','$1')}|clip





Explanations:

TYPE '%L'  |   Foreach{   $_   -Replace('^.+(\\.+?\\.+)$'  ,  '$1')   }  |  clip


TYPE = DOS command
'%L' = TCs parameter. Open a button like to modify, but press F1-key to read the help.
|Foreach{...} = PowerShell syntax to read each line from TCs '%L' temp file
$_ = current processed line with path information from TCs '%L' temp file
-Replace( '^.+(\\.+?\\.+)$', = RegEx Replace to match last two path elements only
'$1') = and only use (replace by) that matched part
}| = PowerShell syntax
clip = Windows Clip.exe


 
parakovsky
Junior Member
Junior Member
Posts: 7
Joined: 2016-09-20, 07:19 UTC

Re: PowerShell:cm_CopyFullNamesToClip but only parts of the

Post by *parakovsky »

Thanks, and it looks like a lot of ground needs to be covered, and one post is in Deutsch, which I have A+ at school but haven't been using for a long time.
Stefan2 wrote:
parakovsky wrote:we just need folder1/file.ext for our purpose, am sure it can be done, but how?
We have to utilize a external tool to modify the strings of each path.

....

 
Post Reply