Stripping styling from the clipboard...

Tore Nilsen tore.nilsen at me.com
Sat Jun 23 17:15:10 EDT 2018


From the dictionary:

The LiveCode development environment traps the pasteKey message <>, unless "Suspend LiveCode UI" is turned on in the Development menu. This means that the pasteKeymessage <> is not received by a stack <> if it's running in the development environment <>.

So if you are trying to do this in the IDE, then that may be the reason it will not work.

Best regards
Tore Nilsen 

> 23. jun. 2018 kl. 22:32 skrev Richmond Mathewson via use-livecode <use-livecode at lists.runrev.com>:
> 
> Hey, Wow, it's the Richmond school of shovels and primitive stuff at its worst.
> 
> If I have a field that conatins some styled text (let's call it "ff1"), and I want to shift it
> with its styling removed into another field (let's call it "ff2") then this does the trick in a button:
> 
> onmouseUp
> gettheplainTextoffld "ff1"
> putit intofld "ff2"
> endmouseUp
> 
> and that, oddly enough, might not be a bad place to get started.
> 
> ALTHOUGH (ouch) this does NOT work:
> 
> onpasteKey
>   gettheplainTextoftheclipboardData
>   putit intofld "ff2"
> endpasteKey
> 
> and this does not work:
> 
> onpasteKey
>  puttheclipboardDataintofld "ff1"
>  send"mouseUp" tobtn "Button"
> endpasteKey
> 
> which would seem to suggest pasteKey is NOT trapping the paste signal at all.
> 
> Richmond.
> 
> 
> On 23/6/2018 5:15 pm, Paul Dupuis via use-livecode wrote:
>> Using LC9, I want to add a "paste without formatting" (as seen in may
>> browser edit menus) command and I can't see to figure out how to do it.
>> 
>> My most recent attempt of many still pastes formatted text (with
>> underlining, bolding, italics, fonts, colors, etc. in place)
>> 
>> *on*pasteKey *-- remove formatting*
>> *if* theclipboardData["text"] isnotempty*then*
>> *set*thetextofthetemplateFieldtoclipboardData["text"]
>> *set*theclipboardDatatoempty
>> *set*theclipboardData["text"] totheplaintextofthetemplateField
>> *end* *if*
>> *paste*
>> *end*pasteKey
>> 
>> Maybe I just haven't had enough Caffeine yet?
>> 
>> 
>> _______________________________________________
>> use-livecode mailing list
>> use-livecode at lists.runrev.com
>> Please visit this url to subscribe, unsubscribe and manage your subscription preferences:
>> http://lists.runrev.com/mailman/listinfo/use-livecode
> 
> _______________________________________________
> use-livecode mailing list
> use-livecode at lists.runrev.com
> Please visit this url to subscribe, unsubscribe and manage your subscription preferences:
> http://lists.runrev.com/mailman/listinfo/use-livecode




More information about the use-livecode mailing list