triggers, performance and help with...
Peter M. Brigham
pmbrig at gmail.com
Sun Jul 7 00:29:14 EDT 2013
On Jul 6, 2013, at 11:42 PM, Mark Rauterkus wrote:
> My budding solution, but still needs a touch up on the first lines.
>
> Can "replace" include a "return" so that the words to be replaced can be
> sure to be on their own line?
>
>
> on mouseUp
> -- slug in a cr before "Prior data" to be sure content on that line is
> not eliminated.
> replace "Prior data:" with "return Prior data:" in field "field1"
> replace "Concludes data." with "Concludes data. return" in field "field1"
>
> put lineOffset("Concludes prior", field "field1") into whichLineEnd
> put lineOffset("Prior data:", field "field1") into whichLineStart
> put WhichLineEnd - whichLineStart into tempLines
> Add 1 to tempLines
> Repeat for tempLines
> Delete line WhichlineStart of field "field1"
> end Repeat
>
> end mouseUp
your lines putting in extra returns at the start won't work as you have them, since in place of "Prior data:" you will get "return Prior data:" -- since the word "return" is inside the quotes. You need to do
replace "Prior data:" with return & "Prior data:" in field "field1"
using the concatenation operator (&) to join the return to the quoted string.
But this is not necessary, nor is it necessary to delete the lines in a repeat loop. Assuming you want to delete the "Prior data:" line and the "Concludes prior." lines along with everything in between, do this:
put lineOffset("Concludes prior", field "field1") into whichLineEnd
put lineOffset("Prior data:", field "field1") into whichLineStart
delete line whichLineStart to whichLineEnd of fld "field1"
But you might want to keep the marker lines and just delete (or replace) the data between them, in which case:
delete line whichLineStart+1 to whichLineEnd-1 of fld "field1"
-- Peter
Peter M. Brigham
pmbrig at gmail.com
http://home.comcast.net/~pmbrig
More information about the use-livecode
mailing list