我如何设置指针或标志以指示滚动字段内的停止进程
How i set a pointer or flag to indicate that stop process inside Scrolling Field
我有一个滚动字段,我正在尝试实现替换特定区域的内容,但是替换时整个内容都被更改了。我如何设置指针或标志来指示停止替换或停止进程。我的代码是
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
我不确定您想要什么或为什么,但这里有一个示例可以满足您的要求:替换字段特定区域中的字符串。
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
我有一个滚动字段,我正在尝试实现替换特定区域的内容,但是替换时整个内容都被更改了。我如何设置指针或标志来指示停止替换或停止进程。我的代码是
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
我不确定您想要什么或为什么,但这里有一个示例可以满足您的要求:替换字段特定区域中的字符串。
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