catching pasted text and forcing unicode

J. Landman Gay jacque at hyperactivesw.com
Sun Oct 25 02:15:07 EDT 2015


On 10/24/2015 7:48 PM, Dr. Hawkins wrote:
> On Sat, Oct 24, 2015 at 2:25 PM, J. Landman Gay <jacque at hyperactivesw.com>
> wrote:
>
>> I think the pasteKey message is what you want. Note that the IDE traps it,
>> so you won't receive it there but it works in a standalone or when you
>> suspend the development tools.
>
>
> That would let me trap it, and I'm resigned to that (just another button, I
> suppose).  But is there any sane way to deal with the text?

You wouldn't necessarily need a button, pasteKey is a message. Grab the 
clipboardData and process it. If you're in LC 7.x try textDecode, in 
previous versions we used this, which usually works with Word text:

function utf8decode pString
   return unidecode(uniencode(pString,"UTF8"))
end utf8decode

So something like this either in the field script or in the message path:

on pasteKey
   get the clipboardData
   put utf8decode(it) into fld <whatever>
end pasteKey

-- 
Jacqueline Landman Gay         |     jacque at hyperactivesw.com
HyperActive Software           |     http://www.hyperactivesw.com




More information about the use-livecode mailing list