Don't want iBooks to always paste the "Excerpt From" of what I have copied
I read on iBooks, and some other resources and gather my notes in EverNote. When I copy a text from iBooks to keep it as a note in some other external application like EverNote, it keeps pasting the source info which is so annoying and I have to keep deleting them after every copy-paste. For example:
“To bind this class using Ninject, I specify the value of the constructor parameter using the WithConstructorArgument method in the AddBindings method, as shown in Listing 6-20.”
Excerpt From: Adam Freeman. “Pro ASP.NET MVC 5.” iBooks. https://itunes.apple.com/WebObjects/MZStore.woa/wa/viewBook?id=4CB3769B56E7D2A905C0332D53D7E31D
Here is a solution that requires no third-party software and lets you keep using the standard ⌘C shortcut to copy text in Books.
1. Create a Quick Action “Copy without Citation in Books”
- Open Automator and choose File > New (⌘N).
-
For the type of document, choose Quick Action. This will allow us to create a keyboard shortcut for it later.
-
Configure the workflow as follows:
-
Workflow settings
- Workflow receives current [text] in [Books]
- (Leave the other three settings at the default)
-
Add in the actions list:
- Copy to Clipboard
-
Use ⌘S to save the Quick Action. Name it “Copy without Citation in Books”.
The “workflow receives current text in Books” setting in the workflow bypasses the clipboard-modifying behavior of Books. Thus, the workflow needs no extra action to strip the text added by Books.
2. Give the Quick Action a keyboard shortcut of ⌘C in Books
- Open System Preferences > Keyboard. View the Shortcuts tab and select App Shortcuts on the left.
- Click the + button to add a new App Shortcut.
-
Fill in the sheet as follows:
- Application: Books
- Menu Title: Copy without Citation in Books
- Keyboard Shortcut: ⌘C
-
Click Add. You will see the shortcut appear in the list:
And you’re done. From now on, when you want to copy your selected text in Books, just press ⌘C and the exact text will be copied.
This blog post gives an example of how to do it using an Automator script with a keyboard shortcut.
In Automator, create a new Quick Action that receives no input. Give it these three actions:
- Get Contents of Clipboard
- Run Shell Script
- Copy to Clipboard
Put this in the Run Shell Script action:
# strip out iBooks citation
sed -E -e 's/^[ ]?[0-9]* //g' | sed -E -e 's/“[ ]?[0-9]?[ ]?//g' | sed -E -e 's/”$//g' | sed -E -e 's/^(Excerpt From).*//g'
After saving the service, you can assign a shortcut to this action, such as ⌃⌥⌘I, in System Preferences > Keyboard > Shortcuts > Services. Then you hit that shortcut before you paste if you want to get rid of the text that iBooks added.