Copying from MS word into RunRev 4.0
jhurley0305 at sbcglobal.net
Fri Sep 2 20:14:44 EDT 2011
> 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:
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.
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.
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
put results into field 2
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.
More information about the Use-livecode