Как заменить содержимое между begin{document} и end{document}. при использовании моего кода весь контент заменяется. В приведенном ниже коде я использую wordOffset, но он не работает
on mouseUp
put wordOffset("begin{document}",fld "MytextField") into tBegin
put wordOffset("end{document}",fld "MytextField") into tEnd
put the htmlText of field "MytextField" into myHtml
--put wordOffset("begin{document}",fld "myHtml") into tBegin
--put wordOffset("begin{document}",fld "myHtml") into tEnd
set the caseSensitive to true
put the field SRText into myArrayToBe
split myArrayToBe by CR
--enable the field "SRText"
--put "red,RED" & CR & "green,GREEN" & CR & "blue,BLUE" into myArrayToBe
--split myArrayToBe by CR
put the number of lines of (the keys of myArrayToBe) into myArraylength
repeat with i = 1 to myArraylength
--return i
put myArrayToBe[i] into y
split y by colon
put y[1] into searchStr
put y[2] into replaceStr
if searchStr is empty then
put the 0 into m
else
--put (word tBegin to tEnd of fld "MytextField")
--put replaceText(word tBegin to tEnd of fld "MytextField","searchStr","good") into word tBegin to tEnd of fld "MytextField"
put wordOffset("begin{document}",fld "MytextField") into tBegin
put wordOffset("end{document}",fld "MytextField") into tEnd
--put holder into myHtml
--put replaceText(word tBegin to tEnd of fld "MytextField",searchStr,replaceStr)of fld "MytextField"
replace searchStr with "<strike><font bgcolor=" & quote & "yellow" & quote & ">" & searchStr & "</font></strike><font bgcolor=" & quote & "green" & quote & ">" & replaceStr & "</font>" in myHtml
end if
end repeat
--enable me
set the htmlText of fld "MytextField" to myHtml
end mouseUp