Loading ...
Sorry, an error occurred while loading the content.

clip programming question

Expand Messages
  • skite73
    I am trying to write a clip that allows me to highlite text, converts the text to sentence case, trims all trailing spaces and then copies the text to the
    Message 1 of 2 , Aug 7, 2005
    • 0 Attachment
      I am trying to write a clip that allows me to highlite text, converts
      the text to sentence case, trims all trailing spaces and then copies
      the text to the clipboard. The problem that I am seeing is that
      unless the text is re-selected between the converting to sentence
      case command and the string trim command, the text ends up being
      printed twice on the screen. If the text is re-selected between
      these two commands the clip works correctly. Is there a way around
      this?


      Here is part of the clip:
      ;Join Lines
      ^!Keyboard CTRL+J
      ^!SetWordWrap ON
      ;Convert to sentence case
      ^$StrSentenceCase("^$GetSelection$")$
      ;Trim all extra spaces from string
      ^$StrTrim("^$GetSelection$")$
      ^!Keyboard CTRL+A
      ^!Keyboard CTRL+C


      Steve
    • hsavage
      ... Steve, Here are 2 copies of the same clip, 1 with, and 1 without comments to demonstrate the size reduction. This clip will copy text to clipboard, convert
      Message 2 of 2 , Aug 7, 2005
      • 0 Attachment
        skite73 wrote:
        > I am trying to write a clip that allows me to highlite text, converts
        > the text to sentence case, trims all trailing spaces and then copies
        > the text to the clipboard. The problem that I am seeing is that
        > unless the text is re-selected between the converting to sentence
        > case command and the string trim command, the text ends up being
        > printed twice on the screen. If the text is re-selected between
        > these two commands the clip works correctly. Is there a way around
        > this?
        >
        > Here is part of the clip:
        > ;Join Lines
        > ^!Keyboard CTRL+J
        > ^!SetWordWrap ON
        > ;Convert to sentence case
        > ^$StrSentenceCase("^$GetSelection$")$
        > ;Trim all extra spaces from string
        > ^$StrTrim("^$GetSelection$")$
        > ^!Keyboard CTRL+A
        > ^!Keyboard CTRL+C
        >
        > Steve

        Steve,

        Here are 2 copies of the same clip, 1 with, and 1 without comments to
        demonstrate the size reduction.

        This clip will copy text to clipboard, convert and trim, if you haven't
        selected multiple paragraphs. ^$StrTrim("")$ doesn't work too well
        across paragraphs. It only catches the beginning and end spaces in a
        selection. In NotePro paragraphs are delimited by carriage-returns, crlf's.

        If your objective is for the text to remain in the clipboard for pasting
        elsewhere end the clip commands prior to the ^!PasteSelect command.

        The text, regardless, will remain in the clipboard until something else
        is copied to clipboard, or, otherwise cleared.

        With clip questions please join and address the Clips-List, to subscribe
        send an empty email to this address;

        ntb-clips-subscribe@yahoogroups.com

        -------------------------

        H="Join-Convert-RePaste"
        ^!Clearvariables
        ^!Setscreenupdate 0
        ;
        ; if wordwrap off, remains off, else, turns off then back on later.
        ^!Set %ww%=^$IsWordWrap$
        ^!SetWordWrap 0
        ;
        ; join lines - copy to clipboard
        ^!ToolBar Join Lines
        ^!ToolBar Copy
        ;
        ; convert to sentence case - Trim extra spaces from string ends
        ^!SetClipboard ^$StrSentenceCase(^$StrTrim("^$GetClipboard$")$)$
        ; at this point the modified string is in the clipboard
        ;
        ; pastes modified string over selected string
        ^!PasteSelect
        ;
        ; sets wordwrap to original setting
        ^!Setwordwrap ^%ww%
        ;
        ; jumps to beginning of, and deselects text
        ^!Jump SELECT_START


        This could be shortened further, but, not recommended, by eliminating
        the wordwrap commands.

        H="Join-Convert-RePaste 1"
        ^!Clearvariables
        ^!Setscreenupdate 0
        ^!Set %ww%=^$IsWordWrap$
        ^!SetWordWrap 0
        ^!ToolBar Join Lines
        ^!ToolBar Copy
        ^!SetClipboard ^$StrSentenceCase(^$StrTrim("^$GetClipboard$")$)$
        ; >
        ^!PasteSelect
        ^!Setwordwrap ^%ww%
        ^!Jump SELECT_START

        ºvº
        05.08.07
        hrs > hsavage@...
      Your message has been successfully submitted and would be delivered to recipients shortly.