.
.   
NEdit.org
   .

Home
 - News - Download - Documentation - Search - FTP     
.
.
  

Append to clipboard

[Back]

The following adds the selection to the end of the clipboard:

if ($selection_start == -1)
   string_to_clipboard("")
else
   string_to_clipboard(clipboard_to_string() get_selection())
The if statement clears the clipboard if nothing is selected.

If you like a little more sophisticated code, which inserts a space between the existing clipboard content and the selection if the selection starts at the begin of a word, or inserts a newline if selection begins at a new line, try

if ($selection_start == -1)
   string_to_clipboard("")
else
{
   cString=clipboard_to_string()
   addStr=get_selection()
   if(cString=="") {
      string_to_clipboard(addStr)
   } else {
      cLastChar=substring(cString, length(cString)-1 , length(cString))

      if(search("^", $selection_start, "regex") == $selection_start) {
         if(cLastChar!="\n") addStr="\n" addStr
      } else if($selection_start==search("<", $selection_start, "regex")) {
         if(search_string(cLastChar, "[a-zA-Z_0-9]", 0, "regex") != -1 ) addStr=" " addStr
      }
      string_to_clipboard(cString addStr)
   }
}
[Back]

. Released on  Wed, 21 Nov 2001  by C. Denat  

  
Visit our sponsor
Check Metrolink

© NEdit.org
1999-2001
All rights reserved


.