3D Clipboard

A place to discuss 3D Clipboard

plain text

Share actions you've created here.
Bill
Posts: 4
Joined: Tue Mar 19, 2013 4:52 pm

plain text

Postby Bill » Sun May 08, 2016 5:26 pm

I thought I had submitted this one 2 years ago. Apparently not.

How many times have you wanted to copy something as plain text only to have the result in Bold, Underlined, and in color? I finally got tired of copying something to Notepad and then recopying the plain text to my target document. The following VBscript takes care of all those pesky special codes and gives back just plain text.
One caveat - this will not work with things like <esc> sequences where you have a single special character followed by a string of regular characters. The special character will be deleted but the regular characters will remain.

Code: Select all

' Action: plain text
' Author: Bill King
' Date: 04-11-14
' Code: VBscript
'
' Some notes:
'    This only works on Ascii characters
'    The resulting string does NOT include "extended ascii" characters (e.g. non-english or mathematical characters)
'    The resulting string DOES include the 'linefeed', 'carriage return', and 'tab' characters.
'

Tcase1 = ""
strCBI = clipboard.value
intlencbi = len(strcbi)
For Indx = 1 To intlencbi
   ch = Asc(Mid(strCBI, Indx, 1))

   If ((ch > 31) and (ch < 127)) Then         ' letter is printable
      Tcase1 = Tcase1 & Chr(ch)               ' Keep building the new string
   ElseIf (ch=10) Then                     ' letter is "line feed"
      Tcase1 = Tcase1 & Chr(ch)               ' Keep building the new string
'      End If
   ElseIf (ch=13) Then                     ' letter is "carriage return"
      Tcase1 = Tcase1 & Chr(ch)               ' Keep building the new string
'      End If
   ElseIf (ch=9) Then                     ' letter is "tab"
      Tcase1 = Tcase1 & Chr(ch)               ' Keep building the new string
'      End If
   End If
   
' --- if the character is not one of the above, then it is skipped
Next
'
clipboard.value = TCase1


Return to “Actions”

 

 

cron