Zam
Zam

Reputation: 377

How to preserve text content in livecode

I need to preserve contents before begin{text} and after end{text}.If i had two buttons named "Preserve" and "Restore". If i click Preserve button the entire text above begin{text} and after end{text} will copy to some txt file. after my editing if i click the "Restore" button the entire document which was preserved will past in the same place. Is it possible? I am using this coding for replacement

put the htmlText of field "MytextField" into myHtml
  set the caseSensitive to true
replace searchStr with  "<strike><font bgcolor=" & quote & "yellow" & quote & ">" & searchStr & "</font></strike><font bgcolor=" & quote & "green" & quote & ">" & replaceStr & "</font>" in myHtml
 set the htmlText of fld "MytextField" to myHtml

I don't have any editing in before begin{text} and after end{text}. so i can able to save time and accuracy

Upvotes: 1

Views: 80

Answers (1)

MaxV
MaxV

Reputation: 631

Probably you are looking for this:

put the htmlText of field "MytextField" into myHtml
put offset("begin{text}",myHtml) into startchar
put offset("end{text}",myHtml) into endchar
put char startchar to endchar of myHtml into text_to_preserve
put char 1 to (startchar - 1) into text_toEdit1
put char (endchar + 1) to -1 into text_toEdit2

Upvotes: 3

Related Questions