On Mon, 1 Apr 2013 13:14:11 -0300 Haroldo Stenger <[email protected]> wrote:
> hi Terry, > > 2013/4/1 Terry Brown <[email protected]> > > > This script: > > --- cut here --- > > paras = c.p.b.split('\n\n') > > > > for para in paras: > > > > nd = c.p.insertAsLastChild() > > nd.h = para.split('\n')[0][:20] # first 20 char. of first line > > nd.b = para > > > > c.redraw() > > --- cut here --- > > > > very cute script indeed. > > > > chops itself up into paras in child nodes > > > > I assume you've found the script-button button, which will add a button > > 'foo' to execute a script defined in the node selected when the > > script-button button is pressed, so that later you can execute that > > script on whatever node's selected when the foo button's pressed. > > You'd need that if you want the above to slice up nodes other than > > itself :-) > > > > > aha ! so that's when you acces g.p , to get the data in the node you are > "pointing" to, and not the one the script lives in, right? c.p, as you amended, yes. I don't even know how to work out the p for the script the node lives in, when running from a button, but of course if you really need to run a script on itself, you can just use run-script, ctrl-b. Or click a button you've created with script-button when the script's node is selected, but obviously running a script on itself if an unusual case. Cheers -Terry > best, > > h > -- You received this message because you are subscribed to the Google Groups "leo-editor" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To post to this group, send email to [email protected]. Visit this group at http://groups.google.com/group/leo-editor?hl=en. For more options, visit https://groups.google.com/groups/opt_out.
