# sample script
# converts the selected text to upper case
# if no text is selected, is converts the hole buffer
# (C) 2000 Pablo De Napoli (under GPL)
import string
import glimmer
if glimmer.has_selection():
begin = glimmer.selection_start()
end = glimmer.selection_end()
else:
begin=0
end= glimmer.buffer_size()
s = glimmer.get_text(begin,end)
glimmer.freeze()
glimmer.delete_text(begin,end)
glimmer.move_to(begin)
glimmer.insert(string.upper(s))
glimmer.thaw()
|