我有一个滚动字段我试图实现替换特定区域上的内容,但更换整个内容时更改。我如何设置指针或标志以指示停止替换或停止进程。我的代码是
on mouseUp
put the htmlText of field "MytextField" into myHtml
set the caseSensitive to true
put the field SRText into myArrayToBe
split myArrayToBe by CR
put the number of lines of (the keys of myArrayToBe) into myArraylength
repeat with i = 1 to myArraylength
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
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
set the htmlText of fld "MytextField" to myHtml
end mouseUP
答案 0 :(得分:0)
我不确定你想要什么或为什么,但这里有一个例子可以满足你的要求:替换字段特定区域的字符串。
on mouseUp
put urlDecode("aaa+bbb+ccc+ddd+aaaa+ffff+gggg+aaaa+rrrr+dddd+ggg+dddd%0D%0Agggg+fff+eeeee+fff+ssss+ddd+aaaa+%0D%0Adddd+aaaa") into fld 1
wait 30 ticks // so you can see that something happens
lock screen
select word 4 to 10 of fld 1
replace "a" with "x" in the selection
select empty
end mouseUp