Clipboard problem with Word and LC

Charles Szasz cszasz at mac.com
Fri Oct 16 01:19:52 EDT 2015


I have been struggling with a font/clipboard problem for four days.  The following script works great on the Mac (Yosemite) and LC 5.5.5 placing text from a field “preview” onto to a clipboard and then pasted into a word processing document. The type of font and font size is set from the font menu in an option button.

But on Windows XP and Windows 8 the Windows app continues to give a Tahoma font and 9 point size font for all of the fonts when pasted into the Windows version of Open Office.  

I check the clipBoardData with the following command in the message box on both Mac and Windows versions of LC 5.5.5:

put keys(the clipBoardData)

which yielded:
styles
rtf
unicode
text

So there is styled text on the clipboard.

Here is the button script for adding the contents of field “preview” to the clipboard. Please note I tried both RTF and htmlText code but neither worked in Windows

on mouseUp
   if field "preview" <> ""
   then
     set the clipboardData to empty
      
     set the clipboardData["RTF"] to the RTFText of field "preview" 
                                                                    
      --set the clipboardData["html"] to the htmlText of field “preview” This gives the same results as RTF
                                                          
   else
      answer information "You have no completed form to add to the clipboard."
   end if
end mouseUp

I also an option font menu for field “preview” with the following script:

on menuPick pItemName
   switch pItemName
      case "Select Font and Font Size for MSE in Document"
         set the textFont of field "preview" to "Arial"
         set the textSize of field "preview" to "12"
         break
      case "Arial - 10 point"
         set the textFont of field "preview" to "Arial"
         set the textSize of field "preview" to "10"
         break
      case "Arial - 11 point"
         set the textFont of field "preview" to "Arial"
         set the textSize of field "preview" to "11"
         break
      case "Arial - 12 point"
         set the textFont of field "preview" to "Arial"
         set the textSize of field "preview" to "12"
         break
      case "Georgia - 10 point"
         set the textFont of field "preview" to "Georgia"
         set the textSize of field "preview" to "10"
         break
      case "Georgia - 11 point"
         set the textFont of field "preview" to "Georgia"
         set the textSize of field "preview" to "11"
         break
      case "Georgia - 12 point"
         set the textFont of field "preview" to "Georgia"
         set the textSize of field "preview" to "12"
         break
      case "Palatino - 10 point - Mac only"
         set the textFont of field "preview" to "Palatino"
         set the textSize of field "preview" to "10"
         break
      case "Palatino - 11 point - Mac only"
         set the textFont of field "preview" to "Palatino"
         set the textSize of field "preview" to "11"
         break
      case "Palatino - 12 point - Mac only"
         set the textFont of field "preview" to "Palatino"
         set the textSize of field "preview" to "12"
         break
      case "Tahoma - 10 point"
         set the textFont of field "preview" to "Tahoma"
         set the textSize of field "preview" to "10"
         break
      case "Tahoma - 11 point"
         set the textFont of field "preview" to "Tahoma"
         set the textSize of field "preview" to "11"
         break
      case "Tahoma - 12 point"
         set the textFont of field "preview" to "Tahoma"
         set the textSize of field "preview" to "12"
         break
      case "Times New Roman - 10 point"
         set the textFont of field "preview" to "Times New Roman"
         set the textSize of field "preview" to "10"
         break
      case "Times New Roman - 11 point"
         set the textFont of field "preview" to "Times New Roman"
         set the textSize of field "preview" to "11"
         break
      case "Times New Roman - 12 point"
         set the textFont of field "preview" to "Times New Roman"
         set the textSize of field "preview" to "12"
         break
      case "Verdana - 10 point"
         set the textFont of field "preview" to "Verdana"
         set the textSize of field "preview" to "10"
         break
      case "Verdana - 11 point"
         set the textFont of field "preview" to "Verdana"
         set the textSize of field "preview" to "11"
         break
      case "Verdana - 12 point"
         set the textFont of field "preview" to "Verdana"
         set the textSize of field "preview" to "12"
         break
   end switch
end menuPick

I also viewed LC business academy short lesson on clipboard but it does not provide any clues on how to solve this problem.  In fact, it actually takes text from a Word (Mac) document and then pastes it into a LC field, which is not the same thing here. 

I would appreciate any help to solve this problem.  

Sent from my iPad



More information about the use-livecode mailing list