I have a Mac (Monterey) situation I could use help with.
For example, in the finder, I can highlight / copy one or more documents such as text documents.
Then I create a new Apple Mail and when I click paste into the body, it will paste in the actual documents.
Many times I totally do not want this result and what I want is to simply paste the names of these documents rather than the actual file.
So what I have to do is open text edit and paste into a plain text page - and this will print out as text - the document full titles which is what I want. Then I can copy this and paste this into the email and I will get the text list in email rather than the actual documents.
Question: is there any simpler method I can use to be able to highlight items in the finder then paste only the names as text in an email rather than the actual files?
I just tested this in Monterey and it worked as expected. I created a new mail message; highlighted and copied the name of a file on my desktop; pasted into the body of the mail message → It pasted the name of the file, not the file itself.
When you highlight the name of the file, make sure you highlight like you were going to rename the file. (ie - click on the filename [dark color highlight]; then click again [light color highlight] - this means it is in rename mode; that’s what you want to copy/paste.
In Finder’s View menu, select Show Path Bar item. Navigate to the folder or file whose name you want and you’ll see the graphical representation of the file path at the bottom of the Finder window. Right click on the folder or filename you want and select Copy “SomeName” as Pathname.
I solved this like you did — except I use Tot, the simple text/note app that sits in my menu bar. So I don’t have to open and close an app or window.
Or, if there are only a few files, I paste into the subject line of the email message, then select-All, cut, and paste the resulting text of filenames into the body of the message.
The problem with the latter is that it removes all of the line breaks. It’s very hard to read like that, so I then go in and add the breaks. It’s pretty quick to do this if you only have a few files.
If I did this regularly, I’d look for a script/Shortcut/TextExpander automation.
Option+CMD+C to copy the files,
and Shift+Option+CMD+V to paste it.
This will also copy the whole path, but you could delete the path infront of the file name with the Search and Replace Function (CMD+F, with a checkmark at “replace”), where you insert the path of the files, and leave the “Replace”-Field just empty.
In the terminal app, use the basename command to extract the filename from a path. Type basename followed by a space and paste in the entire pathname and hit return.
The following command returns “trail” as it is the filename at the end of the pathname “/usr/bin/trail”:
No, I don’t think the command works that way. But like all UNIX commands, basename could be used repeatedly or in a loop within a script that parses multiple inputs as you suggest.
Note that “Service Menu” is checked under Use as Quick Action. As you may know, this allows the Shortcut to be called from the Services sub-menu in the Finder menu.
The “Receive any input” bit before the comment?
That gets added automatically when you check the “Services Menu” checkbox. I suppose it is what enables the Shortcut to be called from the Services menu.