Page 1 of 1

Paste on a Mac

Posted: Thu Oct 18, 2012 6:30 pm
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

Re: Paste on a Mac

Posted: Thu Oct 18, 2012 7:00 pm
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

Re: Paste on a Mac

Posted: Thu Oct 18, 2012 7:11 pm
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

Re: Paste on a Mac

Posted: Thu Oct 18, 2012 9:03 pm
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

Re: Paste on a Mac

Posted: Thu Oct 18, 2012 9:38 pm
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

Re: Paste on a Mac

Posted: Thu Oct 18, 2012 10:38 pm
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

Re: Paste on a Mac

Posted: Fri Oct 19, 2012 10:42 am
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