Format question
Robert Brenstein
rjb at robelko.com
Mon Jun 7 12:37:56 EDT 2004
>I have a tricky issue where I want to run a script to remove double
>spaces in the script of an object but not damage any code which is
>actually injecting it into something. To be clear, I want the
>following:
>
>set the visible of image "monkey" to true
>
>... to look like this:
>
>set the visible of image "monkey" to true
>
>... but what i don't want to do is affect any code trying to do
>something with spaces. For instance:
>
>put "Hello there" into fld 1
>
>... depending on how many times I run my code to clean the extra
>spaces between words this script can end up looking like this:
>
>put "Hellothere" into fld 1
>
>So I guess what I'm saying is I don't want to affect spaces between quotes.
>
>Any ideas?
>
>Sincerely,
>Simon
After a cup of tea, a simpler script:
put empty into newscript
repeat for each line sLine in oldscript
put empty into nLine
repeat for each word sWord in sLine
put sWord & space after nLine
end repeat
put cr into last char of nLine
put nLine after newscript
end repeat
delete last char of newscript
This takes advantage of metatalk's little quirk: text inside double
quotes is considered a single word when using "each word".
Robert Brenstein
More information about the metacard
mailing list