Copying from MS word into RunRev 4.0
keith.clarke at clarkeandclarke.co.uk
Sat Sep 3 02:03:39 CDT 2011
Jonathan, I've just copied & pasted 'it's' (with a curly single right-hand quote) from Word 2010 (Windows) on my Parallels VM into TextWrangler on my Mac and the curly quote character survives intact. So, for me, Word export and the clipboard are working OK.
I repeated this with Word into a new (Mac - I don't have a Win LC development instance) LC stack and new field with the same results (except the field displayed a straight quote). Copying and pasting the single quote from the LC field created some interesting results. Pasting into TextWrangler (and Notepad on Windows) revealed a curly quote (so the Parallels clipboard is OK) but pasting back into Word 2010 (Win) rendered a straight single right hand quote - but that might have been pilot error, as I don't quite understand all Word's pasting options that pop-up?!? ;-)
You might want to repeat the above with your LC (Win) instance and to check that on your system, Word, the Windows clipboard and the Windows LC engine are all working OK - and test manually first, to avoid any script-based complications.
My gut feel is that this may have something to do with LiveCode's current (variable) support for unicode - especially when using scripts to process the clipboardData. Check out numtochar in the dictionary - if you can set the useUnicode property in the right place, you may be lucky and be able to adapt James' handler to work with the curly single right quote.
Again, during testing, it may be sensible to avoid rendering the text in a field but rather use a variable and view via custom properties.
On 3 Sep 2011, at 01:14, James Hurley wrote:
>> Message: 10
>> Date: Fri, 2 Sep 2011 11:21:17 -0400
>> From: Jonathan Lynch <jonathandlynch at gmail.com>
>> To: use-livecode at lists.runrev.com
>> Subject: Copying from MS word into RunRev 4.0
>> <CAC-_fWRN6P5_cmTPHZu3cqT7YTh95r22wudGo=W4ApDpLT5N5g at mail.gmail.com>
>> Content-Type: text/plain; charset=ISO-8859-1
>> Hi everyone.
>> When I type this word into MS Word: it's
>> Then copy and paste it into a field in RunRev, the apostrophe gets omitted.
>> This is on a windows system. The character in question is not the usual
>> apostrophe, but is the curly apostrophe that MS Word uses.
>> This is quite an issue for me. My work around is to hijack the paste
>> operation, use VB Script to create an invisible Word doc and save that doc
>> as a text file, then use Rev to retrieve the contents of the text file. This
>> works, but takes approximately 1.5 seconds to complete the procedure.
>> Does anyone know if the recent versions of Live Code allow for pasting from
>> an MS Word document without omitting characters? I know it worked fine back
>> with RunRev 2.5, so I know it is possible for it to be done.
>> Well, thanks for you help.
> I have been working on a similar problem. However I work with a Mac, where the apostrophe does come through, but as a char num 213.
> I have been first saving the Word document in rtf format and using some tips I got from Jacque. Here is my import handler:
> on mouseUp
> answer file "Get the RTF file."
> put "file:" & it into tFIle
> put url tFile into tText
> replace "\emdash " with "--" in tText
> set the rtfText of field "theText" to tText
> replace numToChar(213) with "'" in field "theTExt"--Here is where the apostrophe is handled.
> replace numToChar(210) with quote in field "theText"
> replace numToChar(211) with quote in field "theText"
> delete line 1 of field "theText""-- Don't ask.
> end mouseUp
> You can add your own variants of "replace numToChar..."
> A very simple way to locate these variants is with something like this in a button script.
> on mouseUp
> put field 1 into tList--This would be the Word text you want to check
> repeat for each char tChar in tList
> put tChar & tab & charToNum(tChar) & cr after results
> end repeat
> put results into field 2
> end mouseUp
> Put the potentially offending Word text into field 1 and read the list of how each character is rendered both as character and as ascii number. Very simple but potentialy revealing.
> Jim Hurley
> use-livecode mailing list
> use-livecode at lists.runrev.com
> Please visit this url to subscribe, unsubscribe and manage your subscription preferences:
More information about the use-livecode