Welcome, Guest. Please Login
Tinderbox
  News:
IMPORTANT MESSAGE! This forum has now been replaced by a new forum at http://forum.eastgate.com and no further posting or member registration is allowed. The forum is still accessible via read-only access for reference purposes. If you wish to discuss content here, please use the new forum. N.B. - posting in the new forum requires a fresh registration in the new forum (sorry - member data can't be ported).
  HomeHelpSearchLogin  
 
Pages: 1
Send Topic Print
Text import workflow (Read 19461 times)
Andrew Saffer
Full Member
*
Offline



Posts: 62

Text import workflow
Apr 17th, 2008, 12:36am
 
My last Psion handheld just died, and I am about to buy a handheld PC of some sort for entering lecture notes on the run.

Right now, I enter text into my handheld, export that file to a .txt, then cut up those notes manually in TB.

Is there a way to type the text in on the handheld such that when I drop it into Tinderbox, the Explode command makes a whole bunch of new notes with Titles and text in the right places?

Thanks,

Andrew
Back to top
 
 
  IP Logged
Mark Anderson
YaBB Administrator
*
Offline

User - not staff!

Posts: 5689
Southsea, UK
Re: Text import workflow
Reply #1 - Apr 17th, 2008, 7:00am
 
Titles and text exactly correct? Out-of-the-box, almost! The 'no' part is note titles as these are taken from the body copy of the new note using the first c.64 characters - see this aTbRef page for more (I just added it as part of this answer).

However, this TB wiki page discusses TB code you can use to truncate a note's title to the first sentence. Actually, it would be neat if that were an explode option, but meanwhile you can do some automation. For instance an agent could find all notes that are children of 'Exploded Text' and (re-)set their titles. To keep the agent in limted scope (i.e. doing less searching) you might use a container specifically as your 'Explode Centre' and limit the agents query to only search within that containers children.

You could even, in v4.1+, use the Container attribute in your actions/rules to move the exploded content automatically to a new location in your TB file.

So whilst it's not all done for you, with a little coding in TB you should be able to achieve all you want for your import & explode process.  

If your notes from the handheld, etc., are plain text format (i.e. no bold, etc. mark-up) then you can drag the note to a TB view, and select Note menu -> Explode...

The result of Explode is that your selected (exploded) note gains a child container called 'Exploded Text' that in turn contains all the new notes from the Explode process. Using this extra container allows for the edge case where the note to be exploded already has children and thus keeping the Explode-created notes separate from them.

What docs don't explain (note- perhaps they should) is that each note
Back to top
 
 

--
Mark Anderson
TB user and Wiki Gardener
aTbRef v6
(TB consulting - email me)
WWW shoantel   IP Logged
Mark Bernstein
YaBB Administrator
*
Offline

designer of
Tinderbox

Posts: 2871
Eastgate Systems, Inc.
Re: Text import workflow
Reply #2 - Apr 17th, 2008, 10:36am
 
A very easy notation might be to type the title followed by a bullet , and then the text of the note followed by TWO returns.  Explode, looking for two returns (\r\r) as the delimiter.

Then, using an agent, collect the notes

    #inside(Exploded Text)&Name((.+)).

That is, we look for notes inside the container for exploded text, that have a Name that begins with some characters followed by a bullet.

The action is

    Name=$1

which means, "replace the name with the first part of the regular expression".  And we're done!
Back to top
 
 
WWW   IP Logged
Mark Anderson
YaBB Administrator
*
Offline

User - not staff!

Posts: 5689
Southsea, UK
Re: Text import workflow
Reply #3 - Apr 17th, 2008, 1:24pm
 
Ideally, another similar rule might/would delete the title text+delimiting marker from the start of the body copy, otherwise the start of each note would look a bit strange. Apologies - I'm not sure-footed enough with regular expressions to suggest what that code would be.

For those not used to using it, the bullet symbol () is easily typed with the Opt+8 key combo.
Back to top
 
 

--
Mark Anderson
TB user and Wiki Gardener
aTbRef v6
(TB consulting - email me)
WWW shoantel   IP Logged
Mark Bernstein
YaBB Administrator
*
Offline

designer of
Tinderbox

Posts: 2871
Eastgate Systems, Inc.
Re: Text import workflow
Reply #4 - Apr 17th, 2008, 2:10pm
 
Another nice trick:  just make a bunch of individual text files, inside a folder.

Drag the folder into Tinderbox.  The file names become the note names; the text in the files become the note bodies.
Back to top
 
 
WWW   IP Logged
Andrew Saffer
Full Member
*
Offline



Posts: 62

Re: Text import workflow
Reply #5 - Apr 22nd, 2008, 2:05am
 
This program just never ceases to amaze me.

I just tried the Agent to change the names of all Exploded Text notes, and it works a treat.

How do I now delete all the body text before the bullet point (I used a tilde, incidentally).

Thanks,

Andrew
Back to top
 
 
  IP Logged
Mark Anderson
YaBB Administrator
*
Offline

User - not staff!

Posts: 5689
Southsea, UK
Re: Text import workflow
Reply #6 - Apr 22nd, 2008, 4:47am
 
Use a single agent to set correctly both title and text:_
Query: #inside(Exploded Text)&Text((.*)(~)(.*))
Action: Name=$1;Text=$3

The first part of the query seeks to limit the scope of the query, but would still match more than one current 'Exploded Text' container. So, if you're using this method a lot you could leave this agent in place a permanent utility.

If your title/text delimiter were tilde+space rather than just tilde, change the (~) in the query to (~ ) or whatever delimiter variant you need, e.g. (~~), (##), etc.

I'm aware the smart way to do this is with regexp lookahead/lookbehind syntax but I couldn't make these work. Doubtless someone here with real regexp skills will offer a more elegant example, but for now the above method works fine.


Back to top
 
 

--
Mark Anderson
TB user and Wiki Gardener
aTbRef v6
(TB consulting - email me)
WWW shoantel   IP Logged
Ioa Petra-ka
Full Member
*
Offline



Posts: 103
Portland, Oregon, USA
Re: Text import workflow
Reply #7 - Apr 22nd, 2008, 6:50pm
 
I have had trouble getting the pre/post-match regexp stuff working. I don't think these syntax options even exist in Tinderbox's implementation, but I could be wrong on that. I've always just encapsulated things with triple back-references like you are doing here.
Back to top
 
« Last Edit: Apr 22nd, 2008, 6:52pm by Ioa Petra-ka »  

Av
  IP Logged
Andrew Saffer
Full Member
*
Offline



Posts: 62

Re: Text import workflow
Reply #8 - Apr 23rd, 2008, 5:57am
 
That's just AMAZING!

Heck, while I'm knee-deep in chutzpah anyway, how do I pre-indent?

Thanks,

Andrew
Back to top
 
 
  IP Logged
Mark Anderson
YaBB Administrator
*
Offline

User - not staff!

Posts: 5689
Southsea, UK
Re: Text import workflow
Reply #9 - Apr 23rd, 2008, 12:57pm
 
Pre-indent what? Paragraphs.  Just the first? Only the first? all?  Is this in the TB note or/both the HTML output?

Assuming it's for internal copy and each note is just one paragraph that you wish to start with a tab intent, I'd assumed this revised agent action might work - Name=$1;Text=\t+$3 - the '\t' being a tab character. But it doesn't work. Quoting it, "\t" doesn't work either as this make the tab placeholder into the text \t". I'm not sure what placeholder if any we can use here to insert a tab at the front of the paragraph text.
Back to top
 
 

--
Mark Anderson
TB user and Wiki Gardener
aTbRef v6
(TB consulting - email me)
WWW shoantel   IP Logged
Mark Anderson
YaBB Administrator
*
Offline

User - not staff!

Posts: 5689
Southsea, UK
Re: Text import workflow
Reply #10 - Apr 23rd, 2008, 1:58pm
 
Also tried HTML/XML encoding of Tab character as &09; but that doesn't work either. you might do better to pass the text to a command line tool and concatenate there before setting the output to the Text attribute, but the latter's not my area of expertise.
Back to top
 
« Last Edit: Apr 23rd, 2008, 2:31pm by Mark Anderson »  

--
Mark Anderson
TB user and Wiki Gardener
aTbRef v6
(TB consulting - email me)
WWW shoantel   IP Logged
Mark Bernstein
YaBB Administrator
*
Offline

designer of
Tinderbox

Posts: 2871
Eastgate Systems, Inc.
Re: Text import workflow
Reply #11 - Apr 23rd, 2008, 3:05pm
 
The easiest workaround for this odd case might be this:
  • Make a note called "tab" inside a container called "config"
  • Open the text of /config/tab; add a tab character
  • Close the text window


Now, your action can say things like Text=$Text(/config/tab)+$1

This is probably gilding the lily, but it's a useful technique when you need to refer to some text that's going to be hard to type directly into an action.

Back to top
 
 
WWW   IP Logged
Andrew Saffer
Full Member
*
Offline



Posts: 62

Re: Text import workflow
Reply #12 - Apr 23rd, 2008, 5:06pm
 
Sorry, I wasn't clear (after all that)!

I meant: Is there a way in a text file (to be Exploded) to set up the first entry as a Container and the next 3 notes as children, then the fourth as a new container etc?

In Outline View, that looks 'indented'...

Thanks, and please don't hate me Wink,

Andrew
Back to top
 
 
  IP Logged
Mark Anderson
YaBB Administrator
*
Offline

User - not staff!

Posts: 5689
Southsea, UK
Re: Text import workflow
Reply #13 - Apr 23rd, 2008, 6:01pm
 
In short, no, not in one pass. I suspect once you get into working out the N-level split delimiters in your source text it's probably quicker to do by drag drop once in Tinderbox, especially (as above) you can easily extract the tittle from each note.

You might, by seeding a nesting level code (1, 1.1, 1.1.1, etc.) into the source text be able to assign notes to containers using an action setting the Container attribute but not do that and remove such delimiters. Still, I've not tried this and I suspect it would be prone to unexpected results.  I still think manual reordering would be faster/more accurate.

Of course you could do successive explodes based on different delimiters...but then you wanted to do this in one pass.
Back to top
 
 

--
Mark Anderson
TB user and Wiki Gardener
aTbRef v6
(TB consulting - email me)
WWW shoantel   IP Logged
Andrew Saffer
Full Member
*
Offline



Posts: 62

Re: Text import workflow
Reply #14 - Apr 24th, 2008, 8:18am
 
Even without the hierachy ability, the developed Agent above saved me over 30 minutes today. Thank you SO much, Andrew
Back to top
 
 
  IP Logged
Pages: 1
Send Topic Print