Page 4 of 4

Re: AppleScript to Export Notes in OPML

Posted: Thu May 16, 2019 3:18 am
by aroddick
(Hello fellow archaeologist!)

Re: AppleScript to Export Notes in OPML

Posted: Thu May 16, 2019 5:15 am
by mjvalente
(Hello there as well!)

Re: AppleScript to Export Notes in OPML

Posted: Mon Mar 22, 2021 11:51 am
by tappazee
iandol wrote: Mon May 13, 2019 6:33 pm Updated the gist, although I am likely to keep the bookends-tool source always up-to-date and it is the same script:

https://raw.githubusercontent.com/iando ... pplescript
This script is excellent! Is there a way to preserve any formatting (bold/italics/underline) given to notes from bookends? I use bold/italics to distinguish quotations from my commentary on them. Thanks

Re: AppleScript to Export Notes in OPML

Posted: Mon Mar 22, 2021 9:18 pm
by iandol
The applescript interface returns text without any formatting (this script uses the older event system, but the newer dictionary also returns text). I suppose there may be a possibility to create a custom format including the note field, and return it as formatted text like HTML, I tested it and bold text in a note does make it to the output...

Code: Select all

tell application "Bookends"
	set myRefs to selected publication items of front library window
	set rtfRefs to format myRefs using "Printout.fmt" as HTML
end tell
but the next question would be the best way to encode it in the OPML, and whether whatever reads the OPML would understand it. I personally don't have time to edit this script.

One other solution would be if Bookends could convert its formatting (which I assume is RTF encoded?), to markdown when accessing individual itemsso at least the formatting would be plain text yet readable to other applications.

Re: AppleScript to Export Notes in OPML

Posted: Tue Mar 23, 2021 5:15 am
by tappazee
Thanks iandol, much appreciated. I have no scripting expertise so I think I'll have to admit defeat there. I'm no going to try to figure out whether there's a way to get paragraph breaks within single bookends notecards as an alternative way to distinguish between quotes and commentary.

Re: AppleScript to Export Notes in OPML

Posted: Tue Mar 23, 2021 9:27 am
by tappazee
iandol wrote: Mon Mar 22, 2021 9:18 pm The applescript interface returns text without any formatting (this script uses the older event system, but the newer dictionary also returns text). I suppose there may be a possibility to create a custom format including the note field, and return it as formatted text like HTML, I tested it and bold text in a note does make it to the output...
I've now found out, courtesy of Jon, how to make multi-paragraph notecards (double returns initiate a new notecard, so separate any returns with a space to keep them within a single notecard). So this provides me with a way to differentiate quotes and my commentary instead of bold/italics.

This leads me to ask if it's possible for your script to enable these within-single-notecard paragraph separations to be reflected in the notes as they appear in scrivener? I just tried it out and they are not currently. Thanks in advance and sorry to pester.

Re: AppleScript to Export Notes in OPML

Posted: Thu Mar 25, 2021 2:23 am
by iandol
As far as I can tell, Notes are already split into separate cards (look at the raw OPML to see), and Scrivener imports them as children of the OPML document:
Screen Shot 2021-03-25 at 14.21.35_SMALL.png
Screen Shot 2021-03-25 at 14.21.35_SMALL.png (38.28 KiB) Viewed 27433 times
At the moment the title is not parsed, this could be added by using markdown headers?

Re: AppleScript to Export Notes in OPML

Posted: Thu Mar 25, 2021 2:34 am
by iandol
Actually, headers are parsed if formatted correctly:

Bookends:
Screen Shot 2021-03-25 at 14.32.11_SMALL.png
Screen Shot 2021-03-25 at 14.32.11_SMALL.png (29.94 KiB) Viewed 27431 times
Scrivener:
Screen Shot 2021-03-25 at 14.32.39_SMALL.png
Screen Shot 2021-03-25 at 14.32.39_SMALL.png (9.91 KiB) Viewed 27431 times