Paste on a Mac

LiveCode is the premier environment for creating multi-platform solutions for all major operating systems - Windows, Mac OS X, Linux, the Web, Server environments and Mobile platforms. Brand new to LiveCode? Welcome!

Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller, robinmiller

Post Reply
lohill
Posts: 770
Joined: Tue Dec 08, 2009 6:37 pm

Paste on a Mac

Post by lohill »

On a PC I can copy a chunk of text from a .pdf file and paste it into a field using 'put the clipboarddata into field "XXX"'. On a Mac when that is done nothing appears in the field. If, however, I copy the text and paste it into TextEdit, then select all that text and copy it again, then say 'put the clipboarddata into field "XXX"' and it is there. Is there a good explanation for why this happens? Also is there a cleaner workaround than what I have to do?

Thanks,
Larry
Klaus
Posts: 14325
Joined: Sat Apr 08, 2006 8:41 am
Contact:

Re: Paste on a Mac

Post by Klaus »

Hi Larry,

just tested here and works without problems!?

Try:
...
put the clipboarddata["text"] into fld x
...
Since "clipboarddata" is an array actually 8)


Best

Klaus
lohill
Posts: 770
Joined: Tue Dec 08, 2009 6:37 pm

Re: Paste on a Mac

Post by lohill »

Hi Klaus,

It still does not work for me. I even tried 'put the clipboarddata["text"] into tData' prior to putting it in the field and there was nothing in tData. It has been this way ever since I can remember and I just finally got tired of trying to work around it.

Larry
Klaus
Posts: 14325
Joined: Sat Apr 08, 2006 8:41 am
Contact:

Re: Paste on a Mac

Post by Klaus »

Hi Larry,

hmm, I'm puzzled, since I tried this here with a couple of PDF files and it works.

What version are you using? I am using 5.5.2.
If I remember correctly there WAS indeed a bug in earlier versions with pasting text from PDFs!


Best

Klaus
lohill
Posts: 770
Joined: Tue Dec 08, 2009 6:37 pm

Re: Paste on a Mac

Post by lohill »

I am also in 5.5.2. The .pdf has been opened in Adobe Reader and the material is about 4 pages worth of text from Investors Business Daily.

Regards,
Larry
lohill
Posts: 770
Joined: Tue Dec 08, 2009 6:37 pm

Re: Paste on a Mac

Post by lohill »

Klaus,

I have attached the script for 'myPaste' which is called from the Edit Menu. It shows how I have had to work around what happens on the Mac but not on the PC.

Code: Select all

on myPaste
   if the visible of field "RawPages" is true then
      put the number of lines of field "RawPages" into tRaw
      if the clipboard is text then
         --put the clipboarddata["text"] into tData
         put the clipboardData["text"]  after field "RawPages"
         send "FormatRawPages" to field "RawPages"
         put the number of lines of field "RawPages" into tNewRaw
         If tNewRaw = tRaw then
            answer warning "Paste failure 'work-around':" & numtochar(10) & numtoChar(10) & "1.  Paste the data into a simple text editor." & \
                   numtochar(10) & "2.  'Select All' from text editor and copy again." & numtochar(10) & \
                   "3.  Paste once more into this application." titled "Paste Failure"
         end if
      end if
   else
      answer warning "Paste is not done here.  Use 'Toggle Views'."
   end if
end myPaste
Thanks for looking,

Larry
Klaus
Posts: 14325
Joined: Sat Apr 08, 2006 8:41 am
Contact:

Re: Paste on a Mac

Post by Klaus »

Hi Larry,

hmm, so obvioulsy PDF <> PDF, looks like this might have to do with the text enconding of your PDFs...
I would consider it a bug, so if you like write to bugs@runrev.com with a sample PDF.

Hint:
Save some typing and use a simple CR instead of numtochar(10) 8)
...
answer "Line 1" & CR & "Line 2" & CR & "Line 3"
...
:D

BTW: CR is the official "Linedelimiter" in Livecode.


Best

Klaus
Post Reply