I am trying to write a shortcut to add text to apple notes (mostly from the books app, so I have you exit books to access the shortcut).
I can easily strip the stuff that Apple adds at the end, but what I want to do is capture the tile and set it as the first line, then the quote, then the author. I can’t seem to figure out how to capture the matched text `Match “Excerpt from\n(.*) in Clipboard” doesn’t seem to what I expect…
select text, tap “copy”, exit books, launch shortcut.
You cannot access shortcuts from inside Books’s share menu.
“Alfred did offer to ransom me, but balked at Ragnar’s price that was ludicrously high, though not nearly so steep as the price Ivar and Ubba extracted from Burghred.”
The Last Kingdom
This material may be protected by copyright.
What I want to do is get that second line and put it in front of the text, leave the third line, and remove lines 1 and 4. and make that a note. IU can do everything except move the second line to before the quote.
Here is really simple example. This assumes the text will always be formatted as you show above. That is, a contiguous blurb of text, followed by one blank line, followed by the other lines. If that format is consistent, this will work for you.
If it is not, you will need a more sophisticated approach depending on the formatting
The question is categorised and about Shortcuts as well as iBooks. Shortcuts is not currently available on the Mac, and so it is referring to iPad/iPhone; though many people have their fingers crossed that this will change with WWDC next week.
That is too specific since if the quoted text crosses a paragraph boundary, the results in multiple lines.
Is it possible, after “split text by new lines” to then do something AppleScript-y like “item of split text whose text starts with “Excerpt”? Or is it possible to iterate over the split text in reverse order (since the last line of split text will be “This material” and split text - 2 will be the “title” I want).
Looks like I can get the last item, remove it, reprocess to get the author, remove it, reprocess to get the title, remove it, reprocess to get the “excerpt from”, remove it. The put text back together as <title>, <all the text that is left>, <author>.
I may see if there’s a session on all the improvements to shortcuts this week, because that sounds terrible.