"cm_CopySrcPathToClip" ending with backslash

Here you can propose new features, make suggestions etc.

Moderators: white, Hacker, petermad, Stefan2

Freodon
Junior Member
Junior Member
Posts: 12
Joined: 2018-09-29, 13:16 UTC

Re: "cm_CopySrcPathToClip" ending with backslash

Post by *Freodon »

Horst.Epp wrote: 2018-10-16, 07:06 UTC
Freodon wrote: 2018-10-15, 19:53 UTC So I started using Quick Access Popup pand it works well... most of the time. Sometimes in tree view it won't let me auto-navigate and paste the path while manually entering the path would actually solve current task. So for such exceptions I still need the TC command...
Or maybe there is a way to just paste current path (without navigating) in QAP?
The default QAP hotkey for this is Shift-Ctrl-C
which can be configured by adding the QAP feature "Reopen Current Folder in Dialogbox"
to your favorites.
Nope. This commands also navigates the dialog to TC's path. In some tree dialogs, it displays a notification about not being able to execute the command due to Windows limitations. In such case, the only quick way to tell the app about the path I want is to manually copy TC's current path from TC itself, which is basically the "cm_CopySrcPathToClip" command.
User avatar
Stefan2
Power Member
Power Member
Posts: 4132
Joined: 2007-09-13, 22:20 UTC
Location: Europa

Re: "cm_CopySrcPathToClip" ending with backslash

Post by *Stefan2 »

Freodon wrote: I frequently use TC to navigate to a directory and then use the "cm_CopySrcPathToClip" command
to copy a path to clipboard, then paste it in another application to choose a directory within that app .
The problem is, the "cm_CopySrcPathToClip" command copies the path without a backslash at the end
(for example: "d:\dir1\dir2" instead of "d:\dir1\dir2\").

..., the only quick way to tell the app about the path I want
is to manually copy TC's current path from TC itself,
which is basically the "cm_CopySrcPathToClip" command.


Click into the box with the path to edit it (or utilize Rename on '..') and then copy it.




Or create your own command:

usercmd.ini
[em_CopySrcPathWithBSToClip]
cmd=CMD /c
param=ECHO %P|CLIP
iconic=1


wincmd.ini
[Shortcuts]
S+P=em_CopySrcPathWithBSToClip ;//Shift+P to copy current path to clipboard (for example: "d:\dir1\dir2\").




For more help see
Collection of English FAQs threads >>> viewtopic.php?p=347043#p347043
or just ask.




 
User avatar
Horst.Epp
Power Member
Power Member
Posts: 6449
Joined: 2003-02-06, 17:36 UTC
Location: Germany

Re: "cm_CopySrcPathToClip" ending with backslash

Post by *Horst.Epp »

Freodon wrote: 2018-10-16, 16:42 UTC
Horst.Epp wrote: 2018-10-16, 07:06 UTC
Freodon wrote: 2018-10-15, 19:53 UTC So I started using Quick Access Popup pand it works well... most of the time. Sometimes in tree view it won't let me auto-navigate and paste the path while manually entering the path would actually solve current task. So for such exceptions I still need the TC command...
Or maybe there is a way to just paste current path (without navigating) in QAP?
The default QAP hotkey for this is Shift-Ctrl-C
which can be configured by adding the QAP feature "Reopen Current Folder in Dialogbox"
to your favorites.
Nope. This commands also navigates the dialog to TC's path. In some tree dialogs, it displays a notification about not being able to execute the command due to Windows limitations. In such case, the only quick way to tell the app about the path I want is to manually copy TC's current path from TC itself, which is basically the "cm_CopySrcPathToClip" command.
There is no need for any tree dialog to change dirs in a app for me.
I just use the hotkey to get the TC path in any Open / Save dialog and it changes to the dir I want.
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
Freodon
Junior Member
Junior Member
Posts: 12
Joined: 2018-09-29, 13:16 UTC

Re: "cm_CopySrcPathToClip" ending with backslash

Post by *Freodon »

Stefan2 wrote: 2018-10-16, 17:37 UTC
Freodon wrote: I frequently use TC to navigate to a directory and then use the "cm_CopySrcPathToClip" command
to copy a path to clipboard, then paste it in another application to choose a directory within that app .
The problem is, the "cm_CopySrcPathToClip" command copies the path without a backslash at the end
(for example: "d:\dir1\dir2" instead of "d:\dir1\dir2\").

..., the only quick way to tell the app about the path I want
is to manually copy TC's current path from TC itself,
which is basically the "cm_CopySrcPathToClip" command.


Click into the box with the path to edit it (or utilize Rename on '..') and then copy it.




Or create your own command:

usercmd.ini
[em_CopySrcPathWithBSToClip]
cmd=CMD /c
param=ECHO %P|CLIP
iconic=1


wincmd.ini
[Shortcuts]
S+P=em_CopySrcPathWithBSToClip ;//Shift+P to copy current path to clipboard (for example: "d:\dir1\dir2\").




For more help see
Collection of English FAQs threads >>> viewtopic.php?p=347043#p347043
or just ask.




 
Thank you. that command should be very useful. I only have one small issue with it: when I paste the path in Notepad, Word etc. it adds a new line character at the end. Any way to bypass this?
User avatar
Stefan2
Power Member
Power Member
Posts: 4132
Joined: 2007-09-13, 22:20 UTC
Location: Europa

Re: "cm_CopySrcPathToClip" ending with backslash

Post by *Stefan2 »

Freodon wrote: 2018-10-17, 10:42 UTC ...I only have one small issue with it: when I paste the path in Notepad, Word etc. it adds a new line character at the end. Any way to bypass this?
This can not be handled, because me think that is added by TC additionally after our calculated output. (any other opinions?)
But we can modify the output in the clipboard, removing the trailing newline there.
That needs a tool who have good clipboard access, like AutoHotkey.
So we would need AutoHotkey.exe and a external script file, if that's fine with you.





 
User avatar
Zaytsev Artem
Junior Member
Junior Member
Posts: 2
Joined: 2015-01-28, 23:12 UTC

Re: "cm_CopySrcPathToClip" ending with backslash

Post by *Zaytsev Artem »

Let me be a necromancer a bit, but i believe it could help someone else.

AutoHotKey is a genious tool, i use it widely and love it but come on! Man asks for a simple solution which AHK is definitely not.
Freodon wrote: 2018-10-17, 10:42 UTC it adds a new line character at the end
It's because of the echo batch-command.
To avoid the CRLF you should use a "set/p=%P" trick.

But this will not be enough because of another problem:
If the path contains some unicode characters - the resulting string in the clipboard will loose them (the characters will be transformed to ANSI closest equivalents).
To overcome this issue we can add a chcp command to set the utf-8 codepage.

The final strings in the usercmd.ini will be:

Code: Select all

[em_CopySrcPathWithBSToClip]
cmd=cmd /c
param=chcp 65001 & echo|set/p=%P|clip
iconic=1
You're a welcome ;-)
User avatar
Stefan2
Power Member
Power Member
Posts: 4132
Joined: 2007-09-13, 22:20 UTC
Location: Europa

Re: "cm_CopySrcPathToClip" ending with backslash

Post by *Stefan2 »

Hi Zaytsev Artem and welcome to your first posting.

Thanks for that trick, seems to work pretty well.



- - -

Original problem:
The problem is, the "cm_CopySrcPathToClip" command copies the path without a backslash at the end.

Solution:
This work around (CopySrcPathWithBSToClip) copies the path
by utilizing the TC parameter %P, which includes the backslash at the end,
and the "set /p" trick doesn't add an trailing line break to that echo dos command.

Code: Select all

TOTALCMD#BAR#DATA
cmd /c
chcp 65001 & echo|set/p=%P|clip
C:\WINDOWS\system32\cmd.exe
CopySrcPath-WithTrailingBackSlash-ToClipboard

1
-1







Find me: CopySrcPathWithBSToClip CopySrcPathWithTrailingBackSlashToClipboard Copy Source Path With Trailing BackSlash To Clipboard
User avatar
Zaytsev Artem
Junior Member
Junior Member
Posts: 2
Joined: 2015-01-28, 23:12 UTC

Re: "cm_CopySrcPathToClip" ending with backslash

Post by *Zaytsev Artem »

Zaytsev Artem wrote: 2020-07-20, 22:47 UTC The final strings in the usercmd.ini will be:
Oops, i made a rude mistake, which wasn't noticed till today. If the path contains spaces, then the code doesn't work good.
As it's %P, not %N, of course we got to use quotes. Here's the corrected string:

Code: Select all

param=chcp 65001 & echo|set/p="%P"|clip
Post Reply