Tinderbox User-to-User Forum (for formal tech support please email: info@eastgate.com)
Tinderbox Users >> Exporting from Tinderbox >> Exporting Notes Individually

Message started by AGHorne on May 24th, 2011, 6:17am

Title: Exporting Notes Individually
Post by AGHorne on May 24th, 2011, 6:17am

I'm trying to export some notes I've made in a container called "Notes"

Ideally, I'm trying to export as plain text, but I can export as html, if needed. I've got my export code correct, but I would like each note to be an individual text file.  How do I do this?

Title: Re: Exporting Notes Individually
Post by Mark Anderson on May 24th, 2011, 7:32am

To export a note as plain text, the contents of the export template is ^text(plain)^ - whether you use Text or HTML export.

File -> 'Export as text' exports one file containing one or more note's content as aggregated via Nakakoji view. By default the file is exported as 'exported file' (no extension). The default output silently overwrites the default output but if you specify a filename it will warn of overwrites. So you could select each note in turn, open Nakakoji view, select the built-in 'text' template and use the export button.

File -> 'Export as HTML' exports the whole doc to HTML, which isn't what you want. There are way to set up the whole doc so bits don't export.  For any note you don't want to export set $HTMLDontExport to true (or un-tick 'Export' on HTML view). For any container for whom you want to suppress all output, set $HTMLExportChildren to false (or un-tick 'Export children' in HTML view). For a few notes, it's simplest to export each via HTML view.

To do the latter, select the note, open HTML view and select the built-in 'plain-text'  template.  If you don't want the default HTML export filename type a name in the 'File name:' box.  Change the 'File Extension:' to '.txt' (include the period!). Then click 'Export'. The first time you do that for a doc you'll be asked for the export location, thereafter the the doc's last used location is remembered. The exported note will be in the export folder is root level. You notes will export into a folder called "Notes" in the export root folder as HTML export reflects the doc hierarchy.

Title: Re: Exporting Notes Individually
Post by AGHorne on May 24th, 2011, 9:06am

I think I might have used a poor choice of words.

I want to export each note as it's own text file.  

Ideally, I want to select the container "Notes" and export the folder's children as individual text documents.  I currently have 123 Children in "Notes", so I'd like to export the container and have 123 notes, with the title of the note as the title of the text documents.

Title: Re: Exporting Notes Individually
Post by Mark Anderson on May 24th, 2011, 9:28am

OK then, as described, export the whole file to HTML. Either configure the doc to not export what you don't need, or export all and ditch the exported files. TB's HTML export is designed to export everything (set to export). There is no feature to just export a subsection, e.g. one branch of an outline - at least none I've come across.

A workaround if the above is all too difficult. Open a new TBX, drag all 123 files across to it (i.e. copying them), then setup HTML export (if not already done in the source TBX) export the new file to HTML, throw away the extra TBX when done.

Title: Re: Exporting Notes Individually
Post by AGHorne on May 24th, 2011, 10:58am

The whole problem with HTML export is the filenames with no spaces.  I'm importing these documents back into Scrivener and would like the title of my documents to match $Name used in Tinderbox.

In Tinderbox my note "This is my note about whatever I'm thinking at the moment" is exported as "ThisismynoteaboutwhateverI'mthinkingatthemoment" and imported into Scrivener with that as the title of my note.... I would just like to have a smooth transition.

Title: Re: Exporting Notes Individually
Post by Mark Anderson on May 24th, 2011, 11:14am

Ah, well $HTMLExportFileNameSpacer - through an unenvisaged usage - might work.

[Later]Tested. Yay. Set the above attribute to " " (a single space). Easiest way is to set an agent to:

query:   inside("Notes")    or "/Notes" if Notes is root level
action:   $HTMLExportFileNameSpacer = " "

If you use odd characters - anything illegal in HTML filenames - in your notes' $Name these characters too will become spaces (see why). Still, I think that fixes your problem.

For once, an upside to an unintended (mis-)use of an attribute.

Title: Re: Exporting Notes Individually
Post by AGHorne on May 24th, 2011, 9:17pm

One question...

I have some notes with longer names, so I set the attribute $HTMLFileNameMaxLenght to a value of 128.  However, now only 8 of about 30 notes export?  Why?

When I set it back to default 24, everything exports correctly.

Thanks again Mark.

Title: Re: Exporting Notes Individually
Post by Mark Anderson on May 25th, 2011, 3:14am

The practical limit is explained on my article on $HTMLFileNameMaxLength, though it's not a page you'd otherwise rush to read!

It looks like TB still uses 'Classic' Mac max filename length limits. If you need longer, I'd mail in a feature request to move to OS X based limits.

For now, testing in v5.9.1, it looks like the maximum allowed filename length - with a '.txt' extension is 27, or 31 if you use no extension.

Don't forget, it's not all Tinderbox' fault, you could try addressing Scrivener's limitations at the other end.  I'm less well placed to comment on the latter as I don't have/use the app. It is worth bearing in mind, as often here we go through complex changes/workarounds just because of the limitations of other apps. Of course, other apps developers are less flexible, but that doesn't sound the case with Scrivener.

If your notes are using $Text, or its first paragraph as the $Name, consider moving the text back into $Text and using a shorter name. It might not be the process you originally intended but it might achieve the same end

Another approach, use TB Export as Text to export all the notes as one piece of text via a template that delimits each note's content with an easily searched for marker string, e.g. "##########". Then in Scrivener, after import use its equivalent of Explode (surely it has one?) to tease the single run of text back in to 123 notes.

Title: Re: Exporting Notes Individually
Post by Martin Boycott-Brown on May 25th, 2011, 4:44am

I may be wrong, but I don't think Scrivener will "Explode" a document like Tinderbox. But Nisus Writer Pro has a macro that will split a document into individual files. I'm not sure of the limitations of the demo version, but you might be able to use the demo (if you don't already own a copy) to split up the single document you've exported from Tinderbox and then import the resulting files into Scrivener. Or if you could turn the single document into OPML, I think Scrivener would import that, but you would need to check. I've hardly used the new version of Scrivener (yet). Using MultiMarkDown is another technique I used -- Scrivener imported a document I had in MMD and turned it into folders and files without much trouble.

Best of luck with it,

Title: Re: Exporting Notes Individually
Post by Paul Walters on May 25th, 2011, 4:59am

Scrivener has an "Import and Split" feature that will split a text file based on a user-defined token (default is "#", no quotes).  The note names are truncated, though longer than 32, I believe.   Scrivener also definitely imports OPML, which is what I use to get material from Tinderbox to Scrivener.

Title: Re: Exporting Notes Individually
Post by AGHorne on May 25th, 2011, 5:19am

I was not at all blaming Tinderbox.

Simply looking for the "smoothest" transition over to Scrivener.  

Thanks for the help, everyone.

Title: Re: Exporting Notes Individually
Post by Mark Anderson on May 25th, 2011, 6:42am

By 'fault', I didn't mean 'blame'.  :) Rather, I was suggesting avoiding the trap to which we're all prone of continuing to push on the closed door in front of us just because it's we were doing when we became stuck. It's a trap I'll admit to falling into more often than I should.

As I'd hoped, some fellow Scrivener users seem to come up with some good alternatives. TB's OPML is pretty solid now after a series of improvements through v5. I've updated my notes on OPML import and export as well as giving code for two export templates (here and here) to use for OPML export.

I've also updated my old OPML-for-Scrivener.tbx demo. Despite the name of the file you can use it to export OPML for use with any app accepting valid OPML. I hope that helps...

Title: Re: Exporting Notes Individually
Post by AGHorne on May 25th, 2011, 7:07am

It most certainly does help. Thanks Mark!

Title: Re: Exporting Notes Individually
Post by Derek Van Ittersum on May 27th, 2011, 1:30pm

I'm brand new to scrivener (been playing with it for a few days, then pulled the trigger on the cross promotion Mark just sent out), but my initial thought was that SimpleNote would be the "smoothest" transition.  Any Scrivener users ran across problems or issues on that front that would make the OPML way more attractive?

One side note: is there a technical reason that led to the fact that aliases don't get synced by simplenote?  In thinking about Scrivener-TBX cross-pollination, I was imagining creating a boolean attribute (Scrivener) that I could use to "tag" notes that I wanted to send to Scrivener, then use an agent to put aliases in the Simplenote container.  Since aliases don't sync, this plan didn't work.

Title: Re: Exporting Notes Individually
Post by Mark Anderson on May 27th, 2011, 1:53pm

Simplenote has no concept of $Name vs. $Text which does mean some care is required setting up your notes.

Title: Re: Exporting Notes Individually
Post by Ioa Petra-ka on Jun 2nd, 2011, 4:41pm

Simplenote would provide the most seamless integration between the two applications. OPML is probably more powerful for one-shot transfers of bulk data (even if just to avoid a slew of heavy network traffic requests), but it's a one-way process. When you drag an OPML file into the Scrivener Binder, it creates an outline hierarchy based on the depth info, and populates documents using the text data embedded in the OMPL structure. Once this is done, that's it. If you want to update the material in Scrivener with a revised one from Tinderbox, you'll have to replace the old outline tree with the newly imported one.

Simplenote on the other hand will keep the content parallel between both applications. A helpful trick is to use Tb's document preferences to narrow down the sync list by tags (I think that needs 5.9.x+). Scrivener puts its own name into every note it syncs, as a tag, and it will also assign the project's code word as a tag, too. So you can not only tell Tb to only hunt for Scrivener assigned notes, but only those that pertain directly to your current work in progress.

Biggest drawback with this workflow is that Simplenote is a plain-text based system. So with the transport protocol being in plain-text, formatting will not sync. This isn't terribly awful in Scrivener as it is designed to work prior to final formatting anyway, but it will hamper some who do require it, and it will limit what all Scrivener/Tinderbox meta-text features (like linking) you can use. In Scrivener, definitely stick with inline footnotes and annotations, as these can be exported to Simplenote as bracketed text. ((Annotations)) and {{Footnotes}}. This way you can see and edit them anywhere, and even add new ones.

That's going to be a limitation with OPML, too. So I'd boil it down to this:

Do you need structure to be transferred? OPML will be your best bet.
Is all you need the content within the structure? Simplenote will do what you need; but it completely ignores structure (which note comes first, depth, etc).

Title: Re: Exporting Notes Individually
Post by Derek Van Ittersum on Jun 3rd, 2011, 1:52pm

Thanks for the explanation.  Looks like simplenote is the way to go for continual cross-talk between apps.  (brainstorming in TBX with maps, then syncing particular notes over to Scriv for integration into the document).

Tinderbox User-to-User Forum (for formal tech support please email: info@eastgate.com) » Powered by YaBB 2.2.1!
YaBB © 2000-2008. All Rights Reserved.