Scratch Pad File Type

Is there any way to store/convert scratch pad notes as .txt files? Seems that Tinderbox does NOT accept .rtf or .rtfd files for drag/drop import or transfer.


I don’t know any way to do what you want, other than by using a third-party tool to convert Scrivener scratchpad files into plain text. Others may know more about such tools than I do.

But personally, for getting “scratchpad-type” notes into Tinderbox, I would - and do - leave Scrivener out of the equation. I use Notational Velocity and Simplenote to synchronise with TBX. Scrivener is a wonderful tool but for this purpose currently there are better ones.

Notational Velocity:

Thanks, Hugh. I’ve got a couple thousand notes on ScratchPad, and use it regularly. So, was hoping to find a way to keep current workflow while adding TBx to the mix. If ScratchPad can’t save notes as .txt, then I could send them to a Scrivener project – then output/compile as .txt files. Kinda cumbersome and distracts from my current workflow, though.

NV and SN are nice and simple and cheap, and I may end up using. But for now they’re just two more diversions from current workflow. Also, using SN with both Scrivener and TBx would add to confusion since, as best I can figure, TBx doesn’t discriminate files on SN – they ALL get dumped into SimpleNote container, including notes synced with Scrivener. So, would lead to the need for multiple accounts and more confusion/distraction…

This is true, Scrivener’s SN interface has forced filtering based on the project keyword, so you really only see the notes that have been assigned to that project. You can wander outside of the boundaries of that in the second step, but this is optional and more advanced in usage. Tinderbox to date is either floodgate or off, like Notational Velocity. You either see everything or nothing depending on whether the feature is engaged.

However, that’s just the Simplenote feature itself. When a tbx file is bound to an SN account, it downloads everything into a “Simplenote” container that is kept up to date with the server as you work. This is, as you point out, a lot of material that is likely irrelevant to the document. This shouldn’t be viewed as a problem, though! Think of it as Tinderbox granting full access to your SN account, but from there you can work only with the parts you need, or to put it another way, the Simplenote container is merely your data source, not your working area.

[size=150]The Easy Way[/size]

Just make an agent with the following AgentQuery:

inside("Simplenote") & $Name.contains("MyNovel")

Where “MyNovel” is substituted with whatever project keyword you are interested in. Now you have a filtered Simplenote list that focusses on a single Scrivener project; just ignore the big one.

[size=150]Linking Scrivener and Tinderbox to a Project[/size]

A more complicated and flexible way.

Disclaimer: I’m not all up to speed on 5.7.x yet, so there might be some more efficient ways to do this.

Say you have a novel in Scrivener, and you’ve set up your notes and maybe a few scenes to be synced to Simplenote. You’ve chosen for this project the keyword, [b]MyNovel[/b]. You run the sync function and end up with three new files on the SN server, added to the several thousand that already exist. Each of these files has a naming structure like this: [b]Visible binder name (ProjectKeyword [BinderID])[/b]

This might look like: [b]Scene 23 (MyNovel [82])[/b]

The format for creating new documents that Scrivener will recognise is, [b]New Scene (MyNovel)[/b]. So you can add notes named like this in Tinderbox, to see them pop up in Scrivener.

So in Tinderbox, to create a tbx file that focusses on this Scrivener project, we’d want to link it up to Simplenote, and then completely disregard the Simplenote container that it creates. Just leave it closed and ignore it; even move it to the bottom of the outline (I think it needs to stay at the top level though).

Now create a new agent, and name it in accordance with the project keyword. In this example, that would be an agent named “MyNovel”. For the query, ignore the UI stuff and just edit and paste in this:

inside("/Simplenote") & $Name.contains("^(.+) \($Name(agent)(\)| \[)")

Now you have a new container that is collecting and displaying items that descend from the Simplenote container, and match the project’s keyword including a little of Scrivener’s known syntax, to reduce false positives in the case where keywords are also common words. Let’s break down the above:

  1. [b]inside("/Simplenote")[/b]: this, right off the top, limits the agent to only searching items within a container named “Simplenote”. The reason for putting this one first is that the second query is more “expensive” in terms of CPU usage, so it makes sense to narrow down the document to the smallest chunk of data that is definitely going to be relevant, first.
  2. [b]$Name.contains()[/b] This uses regular expression syntax. Whatever is in the parenthetical query will be used to match against the list of items in “Simplenote”. At its most basic, it could have been [b]$Name.contains("MyNovel")[/b] as above. This would work, but if “MyNovel” is a common word that appears elsewhere it would produce false positives, and it would also make this agent code “static”. It would only work for MyNovel, whereas the code I used will also work just fine in an agent called “MyBiography”.
  3. I won’t get into all of the specifics of regular expressions, but the code found within the parentheses above looks like this: [b]^(.+) \($Name(agent)(\)| \[)[/b], which in plain English means: Start from the beginning of the string and save any characters you find up to a specified point into a temporary variable, for the termination of this collector, look for an open parenthesis followed by the name of the agent itself ([b]$Name(agent)[/b]), then further followed by a space and an open square bracket OR a closing parenthesis.

Now for the next ingredient, the agent action. Given that we’ve stored the first part of the name into a temporary variable, we can then use that in the Action to produce a prettier title, sans all of Scrivener’s control data. Tinderbox can produce visual titles—that is, what you see in the Outliner isn’t the real name of the item, it just reads as though it were. The underlying name is not changed, as this is important because you don’t want to lose Scrivener’s control syntax or it won’t know to sync and how. So paste this into the Action cell:

$DisplayExpression = $1;

The special variable $1 stores the first collected bit of information from the last regular expression ran in the query. In this case, it contains the binder name of the item that matched, and nothing else. Here is a screenshot of the final agent, with the example outliner that it produces:

[size=80]Note the given name, ‘MyNovel Notes’ is incorrect; pretend that just says ‘MyNovel’.[/size]

In this example, I’ve named three documents in the Binder, “One”, “Two”, and “Three”, synced them from within Scrivener, and then synced Tinderbox. The agent is currently sorting by modified date, which can of course be changed.

Any of the items that you edit in here will be updated on the server and later can be synced into Scrivener.

[size=150]Making Additions to Scrivener Easy[/size]

An even more complex way, but with greater ease of use and flexibility, down the road.

Now let’s take another example that will make it easy to add new notes to your projects without having to mess with Scrivener’s naming scheme, or even look at it while working in Tinderbox. We’ll also dump the reliance on naming notes correctly, and use a proper attribute instead to hold the project keyword. This makes it possible to use whatever names you want in the actual outline.

In this example, enable Simplenote sync and then, create the following components:

  • Container: Name “Work Area”
  • Container: Path & Name “Work Area/New Notes”
  • Agent: Path & Name “Work Area/Live Notes”
  • String Attribute: Name “ProjectKeyword”
  • Boolean Attribute: Name “Offline”; Default: true

For “Work Area” open the info panel and change [b]ProjectKeyword[/b] to “MyNovel” (you might also want to add this attribute to its KeyAttribute list, for easy access in the future).

For “New Notes” copy and paste the following into the note content text area:

$Name = $Name + " (" + $ProjectKeyword(grandparent) + ")"; $Text = $Name + "\n" + $Text; $Container = "/Simplenote"; $Rule=;

Now, open configuration for “New Notes” and paste this into the Rule cell:

[code]if ($ChildCount > 0) {
$Badge = “warning”;
} else {
$Badge =;

if (!$Offline) {
$Name = “Processing new notes for upload!”;
$NameBold = true;

$Rule(children) = $Text;

if ($ChildCount == 0) {
    $Offline = true;
    $Name = "New Notes";


Okay, the first bit contains what you want the child notes (that would be the new notes you’ve created that you want to add to Scrivener, to this container) to do once you are ready to process them. They append the project keyword to the name in a manner which Scrivener will recognise; prepare the content area for Simplenote, which uses the first line of the content (not the Tinderbox name) for the title; and finally moves the note to the Simplenote container, scheduling it for sync. The last thing it does is wipe out its Rule as it is no longer necessary (and in fact would be undesirable as it would lead to an infinite loop of adding ” (ProjectKeyword)” to the end of the title).

In the second chunk of code—placed into the Rule for the container—it is directed to check for whether or not the container is “Offline” and has child notes. If so, it does little except put up a yellow warning badge to indicate there are new notes you haven’t yet synced.

When its $Offline variable is set to false, the main loop will execute. The first thing it does is change the name to an obvious warning to let you know this container is processing its contents and to not mess with it until it is complete. You’ll rarely see this however, as in most cases everything will happen instantaneously.

After that, it applies the text of the “New Notes” note to each child as a Rule and then waits until all of the child notes have processed their rule (which culminates in them exiting this container). Once it detects all children have processed themselves, it shuts down into offline mode again and resets its name.

To make syncing easier, just create a stamp called “Sync Container”, and paste this into the code area:

$Offline = false;

To use it, just select “New Notes” and then invoke the “Sync Container” menu item from the Stamps menu. The rest is automated.

Now, you could avoid this whole manual sync process if you want, by omitting the whole second chunk of code, and instead just paste [b]$Rule = $Text(parent)[/b] into the OnAdd cell for the “New Notes” container. This will whisk things off as soon as you make them and needs in-line editing disabled, since OnAdd processes before you even start typing.

The next thing to fix is the “Live Notes” agent. This one will be similar to our first “MyNovel” agent, except that it now acquires the $ProjectKeyword from the parent container (Work Area) and uses that instead of its own name for the matching value.

So here is the recipe for that agent:

AgentQuery (same above, except using a different attribute for the match string):

inside("/Simplenote") & $Name.contains("^(.+) \($ProjectKeyword(agent)(\)| \[)")

Action (same as before):

$DisplayExpression = $1;

Rule (acquires ProjectKeyword from “Work Area”):

$ProjectKeyword = $ProjectKeyword(parent);

Note you could change the operator to [b]|=[/b] if you don’t anticipate changing this.

[size=120]Optional Things[/size]

  • Make ProjectKeyword a prototype, making sure that $PrototypeBequeathsChildren is set to true (this is the default). Now you can create new “Work Areas” for different projects, all in this same Tinderbox file. Each one will handle items for display and creation appropriate to their corresponding Scrivener project. Just create a new item, assign it to the “Work Area” prototype, pop it open, and set the ProjectKeyword—everything else below that point will automatically use the new setting.
  • Add [b]$Name + " (" + $ProjectKeyword + ")"[/b] to the $DisplayExpression for “Work Area” so you can see which Scrivener project it corresponds with easily—if the project just deals with one project this probably isn’t necessary.

Thanks Ioa, for sharing your workflow and methods with us Scrivener and Tinderbox folks! :slight_smile:

Especially appreciate the detailed post with (!!!) screenshots too!
I’ll slowly work my way through the post.

Happy 2011! (Soon… very soon)

Wow! Thanks, Ioa! I reeeeealllly like easy, so might have to give this a go before discarding my TBx training wheels.

Guess this means there’s no simple way to store/convert Scratch Pad notes as .txt files.

Couldn’t you write a script for that, too? Although that’s not necessarily any simpler. There’s not, say, a box to check in Scrivener preferences to switch the Scratch Pad to saving in .txt instead of .rtf.

I suppose. But I have difficulties enough writing papers, stories, etc. And I’m mucho less capable/interested spending time writing scripts in order to write papers, stories, etc – else I’d be writing Scrivener or Tinderbox type apps for myself.

So, for the time being I’ll send Scratch Pad .rtfd notes to a Scrivener project and output/compile in plain text to a desktop folder that I’ll drop onto a TBx window. I tested this last night and, though it’s somewhat of a workaround, it seemed to work OK.