Stripping styling from the clipboard...

Richmond Mathewson richmondmathewson at gmail.com
Sat Jun 23 16:42:17 EDT 2018


Strike that last remark.

BUT: that script expects one to press the CONTROL key on the Mac
rather than the COMMAND key one usually uses to PASTE,
so how that can be achieved on a Windows or a Linux machine I just don't 
know.

Richmond.

On 23/6/2018 11:39 pm, Richmond Mathewson wrote:
> Oh: and just to make things even odder than usual, it only works when
> the fild "ff1" does NOT have focus (i.e. the cursor is NOT in the field).
>
> Richmond.
>
> On 23/6/2018 11:38 pm, Richmond Mathewson wrote:
>> However, I, at least, am experiencing great joy just at present as this:
>>
>> oncontrolKeyDown KEE
>>    ifKEE is "V" then
>>      puttheclipboardDataintofld "ff1"
>>    else
>>       passcontrolKeyDown
>>    endif
>> endcontrolKeyDown
>>
>> popped UNSTYLED text into fld "ff1"
>> on MacOS 10.7.5 LiveCode 8.1.10
>>
>> Your mileage may vary: but it's sure worth a try!
>>
>> Richmond.
>>
>>
>> On 23/6/2018 11:07 pm, Paul Dupuis via use-livecode wrote:
>>> Thank you for this.
>>>
>>> However, it appears my problem is not with converting the clipboard from
>>> styled text to plain text, but with the "pasteKey" message.
>>>
>>> In LC9.0.0 under Windows 8.1, I create a new text stack and add and
>>> empty field and place the following handler in EITHER the card or stack
>>> script
>>>
>>> on pasteKey
>>>    makeClipboardPlainText
>>>    paste
>>> end pasteKey
>>>
>>> on makeClipboardPlainText
>>>     local tClip, tRawType
>>>    
>>>     if the platform is "MacOS" then
>>>        put "public.utf8-plain-text" into tRawType   -- OSX
>>>     else if the platform is "Linux" then
>>>        put "text/plain;charset=utf-8" into tRawType -- Linux
>>>     else if the platform contains "Win" then
>>>        put "CF_UNICODETEXT" into tRawType -- Windows
>>>     end if
>>>    
>>>     lock the clipBoard
>>>     put the rawClipboardData[tRawType] into tClip
>>>     set the rawClipboardData to empty
>>>     set the rawClipboardData[tRawType] to tClip
>>>     unlock the clipBoard
>>> end makeClipboardPlainText
>>>
>>> And set a break point on the call to makeClipboardPlainText instruction.
>>> I then switch to another applications with styled text, select the text
>>> copy it to the clipboard, return for LC with the insertion point in the
>>> field and press Control-V.
>>>
>>> RESULT: the breakpoint is never triggered and styled text is pasted into
>>> the field.
>>>
>>> If I just have a pasteKey handler with a beep (or anything else) as the
>>> sole instruction, the same result, the breakpoint is never triggered.
>>> The pasteKey message appears broken under both Windows and OSX (tested
>>> under 10.9.5) in LC9.0.0? Can anyone confirm this bug?
>>>
>>>
>>> On 6/23/2018 1:23 PM, Brian Milby wrote:
>>>> _https://github.com/bwmilby/lc-misc/blob/master/ClipboardHelper/clipboardhelper.livecodescript_
>>>>
>>>> Check out this handler. I can answer questions about it this evening
>>>> if needed.
>>>> On Jun 23, 2018, 9:18 AM -0500, Paul Dupuis via use-livecode
>>>> <use-livecode at lists.runrev.com>, 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