Work around for "Excess lines bug"
T. R. Ponn
alptex2 at orwell.net
Thu Sep 25 15:39:01 EDT 2003
Hi all!
I, too, have suffered the mysterious "Excess lines bug" where lots of
lines get appended to the end of (seemingly) random scripts within a
stack. I was reminded of it by a few of the recent threads. Not a
biggy to clean up...but...this afternoon I was bored, so I offer this.
It seems to work, but I have NOT checked it very thoroughly, so
beware...this script may be worth every penny you paid for it! ;-)
Just make a button and place the following script in it. Then put your
helmet on and click it.
local returnCount
on mouseUp
put "button,field,image,graphic,group,scrollbar" into objType
put empty into returnCount
put empty into objectCount
get cleanIt (the script of this stack)
repeat with i=1 to the number of cards
get cleanIt (the script of card i)
repeat with j=1 to the number of items of objType
do "repeat with k=1 to the number of"&&(item j of
objType&"s")&&"of card"&&i&cr&"get cleanIt(the script of"&&(item j of
objType)&&"k of card"&&i&")"&cr&"add 1 to objectCount"&cr&"end repeat"
end repeat
end repeat
put returnCount&&"extra return characters in"&&objectCount&&"objects
in this stack!" into msg
end mouseUp
function cleanIt inData
repeat
if the last char of inData=cr then
delete the last char of inData
add 1 to returnCount
else
exit repeat
end if
end repeat
-- return inData --this can be used in the "do-repeat" above to set
the script of the object being cleaned to one that has no extra retruns
end cleanIt
Presently, all this does is report the number of return chars and the
number of objects...but it can easily be modified to change all of the
scripts.
Best Regards,
Tim Ponn
More information about the use-livecode
mailing list