Pasting tabs into Excel

Richard Burkett richard.burkett at
Mon Feb 5 11:50:14 EST 2018

This is clearly closely related to the problem I had recently copying text from Livecode into Mac Mail. 
YES, Livecode should copy PLAIN text when you ask it to copy PLAIN unformatted text. That said, 

Here’s the script that I ended up using that work for copying a list of tabbed data into Excel. It’s a little different than Brian’s which he sent to help my question (thanks again!). It works in both cases (Mail and Excel), and is set up to work on three platforms.

Richard Burkett
richard.burkett at <mailto:richard.burkett at>

Here it is, as a version to copy text from a field in my test stack:

on mouseUp
   put fld "myField" into tClip
   lock the clipBoard
   set the ClipboardData to empty
   set the ClipboardData to tClip
   put the clipboardData["text"] into tClip
   set the rawclipBoardData to empty
   if the platform is "MacOS" then
      set the rawClipboardData["public.utf8-plain-text"] \
            to textEncode(tClip, "UTF-8" )   -- OSX
   else if the platform is "Linux" then
      set the rawClipboardData["text/plain;charset=utf-8"] \
            to textEncode(tClip, "UTF-8" ) -- Linux
   else if the platform contains "Win" then
      set the rawClipboardData["CF_UNICODE"] \
            to textEncode(tClip, "UTF-16" ) -- Windows
   end if
   unlock the clipBoard
end mouseUp

> From: "J. Landman Gay" <jacque at <mailto:jacque at>>
> On 2/3/18 12:23 PM, Brian Milby via use-livecode wrote:
>> Try this function (LC 8/9):
>> *on*  stripClipboard
>>    *local*  tData
>>    *lock*  the clipboard
>>    *put*  the rawClipboardData["public.utf8-plain-text"] into tData
>>    *set*  the rawClipboardData to empty
>>    *set*  the rawClipboardData["public.utf8-plain-text"] to tData
>>    *unlock*  the clipboard
>> *end*  stripClipboard
>> This will ensure the only thing on the clipboard is the text format (no RTF
>> and no HTML).  Even when I use this function after putting the text on the
>> clipboard, I get the same results.  And I get the same in LC 6 & 7 too.
>> You mentioned raw clipboard, what did you try there?
> Your handler works. :) I haven't used rawClipboardData much and I don't 
> have that particular experiment any more, but I think I just used the 
> example verbatim from the dictionary.
> -- 
> Jacqueline Landman Gay         |     jacque at <mailto:jacque at>
> HyperActive Software           | <>

More information about the Use-livecode mailing list