Special Paste

Peter M. Brigham pmbrig at gmail.com
Tue Nov 17 08:52:40 EST 2015


To expand on this, below are the handlers I have in my LC frontscript, so I can paste and match style anywhere in LC.

-- Peter

Peter M. Brigham
pmbrig at gmail.com
http://home.comcast.net/~pmbrig

----------

on commandKeyDown pKey
   -- to paste plain text
   --    (matching the formatting of the target field)
   -- Mac: command-control-V
   -- Win: control-alt-V
   --    (change these if you wish, in the pastePlain handler)
   -- put this handler and the pastePlain hanlder into a frontscript
   --    where it will operate everywhere in LC
   -- requires pastePlain
   
   switch pKey
      case "V"
         pastePlain
         if the result is "justPaste" then
            pass commandKeyDown
         end if
         break
      default
         -- add your other commandkey scripts before the default
         pass commandKeyDown
   end switch
end commandKeyDown

on pastePlain
   -- to paste plain text
   --    (matching the formatting of the target field)
   -- Mac: command-control-V
   -- Win: control-alt-V
   --    (change these if you wish)
   -- put this handler and the commandKeyDown hanlder into a frontscript
   --    where it will operate everywhere in LC
   -- requires commandKeyDown
   
   if the tool is not "browse tool" \
         or the clipboard is not "text" \
         or the selectedField is empty then
      return "justPaste"
   end if
   switch the platform
      case "MacOS"
         if the controlkey is up then return "justPaste"
         break
      case "Win32"
         if the altkey is up then return "justPaste"
         break
      default
         return "justPaste"
   end switch
   -- now plain text is needed
   put the clipboarddata["text"] into the selectedchunk
end pastePlain

----------

On Nov 17, 2015, at 12:50 AM, Geoff Canyon wrote:

> I think this works:
> 
>   put clipboardData["text"] into the selectedchunk
> 
> There may be failure modes I'm unaware of.
> 
> On Mon, Nov 16, 2015 at 11:25 PM, Charles Szasz <cszasz at mac.com> wrote:
> 
>> I having been trying to implement Paste and Match Style found on Pages app
>> and also on Word, which is called Paste Special, where the text contents of
>> the clipboard are pasted into a document that matches the existing font and
>> font style in the document.
>> 
>> I searched the Rev and LC archives and could not find any examples.  Does
>> anyone have a script for this?
>> 
>> Sent from my iPad
>> _______________________________________________
>> 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