Hallow developers!
PN now able to Set an Lower or Upper Case of selected text. i`ve needed an inverting Case of typed text, IMHO such ability need for completeness.
feature req: Inverting Case
(3 posts) (3 voices)-
Posted 4 years ago #
-
I'm happy to discovering pnotepad and pypn for scripting.
It's difficult to find documentation and examples.
I give you here my first try on pypn script. this should interest AlexRayne.
import string
import pn
import scintilla
from pypn.decorators import script@script("Upper case", "Text")
def UpperCase():
editor = scintilla.Scintilla(pn.CurrentDoc())
editor.BeginUndoAction()
selText = editor.GetText(editor.SelectionStart, editor.SelectionEnd)
selText = selText.upper()
editor.ReplaceSel(selText)
editor.EndUndoAction()@script("Lower case", "Text")
def LowerCase():
editor = scintilla.Scintilla(pn.CurrentDoc())
editor.BeginUndoAction()
selText = editor.GetText(editor.SelectionStart, editor.SelectionEnd)
selText = selText.lower()
editor.ReplaceSel(selText)
editor.EndUndoAction()@script("Capitalize case", "Text")
def Capitalize():
editor = scintilla.Scintilla(pn.CurrentDoc())
editor.BeginUndoAction()
selText = editor.GetText(editor.SelectionStart, editor.SelectionEnd)
selText = selText.capitalize()
editor.ReplaceSel(selText)
editor.EndUndoAction()@script("Title case", "Text")
def TitleCase():
editor = scintilla.Scintilla(pn.CurrentDoc())
editor.BeginUndoAction()
selText = editor.GetText(editor.SelectionStart, editor.SelectionEnd)
selText = selText.title()
editor.ReplaceSel(selText)
editor.EndUndoAction()@script("Invert case", "Text")
def InvertCase():
editor = scintilla.Scintilla(pn.CurrentDoc())
editor.BeginUndoAction()
selText = editor.GetText(editor.SelectionStart, editor.SelectionEnd)
selText = selText.swapcase()
editor.ReplaceSel(selText)
editor.EndUndoAction()
Posted 4 years ago # -
Thanks, added to the default scripts collection
Posted 4 years ago #
Reply
You must log in to post.