hi, all :-)

I have read the scripting chapter of leo-editor, and already make my daily
life easier with
these quick dirty, but useful scripts.

And I just want to know your workflow of writing leo scripts.

My workflow is like this
[e.g., I want to select some text in the body and make transform, then
insert to the body again]:

1. Abstract the action of word.
[in this case, I choose "select" and "insert" as my key words]

2. search the words at http://leoeditor.com/scripting.html see if there is
existing some related topics.
[I have luck to find
i = w.getInsertPoint()              # Return the location of the cursor.
...
i,j = w.getSelectionRange(sort=True)
...
s = w.getSelectedText()             # Return the selected text, if any.
]

3. but I still don't know how to insert the text to body. So I search the
above function names in the scripts.leo to see the code.
[ I find in
scripts.leo#Scripts-->@thin leoScripts.txt-->Text editing scripts-->insert
begin/endUpdate
...
w.insert(i,s1+'\n\t\t\n'+s2)
...
seems to help
]

4. test the scripts to see if it works, if it doesn't work, go to 3, to
find more example code.


what's yours? any suggestion to improve this workflow?

-- 
--
Sincerely,

HaveF

-- 
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.


Reply via email to