Format question
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 Hellothere 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 ___ metacard mailing list [EMAIL PROTECTED] http://lists.runrev.com/mailman/listinfo/metacard
RE: Format question
Try this for each line in your script: put false into isQuoted put empty into myLastChar repeat with i = length (myScriptLine) down to 1 put char i of myScriptLine into ch if ch is quote then put not isQuoted into isQuoted if isQuoted then put empty into myLastChar next repeat end if if not isQuoted then if myLastChar is space then if ch is space then delete char i of myScriptLine end if end if put ch into myLastChar end repeat Wil Dijkstra -Original Message- From: Simon Lord [mailto:[EMAIL PROTECTED] Sent: Mon 6/7/2004 9:42 AM To: MetaCard Cc: Subject:Format question 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 Hellothere 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 ___ metacard mailing list [EMAIL PROTECTED] http://lists.runrev.com/mailman/listinfo/metacard winmail.dat___ metacard mailing list [EMAIL PROTECTED] http://lists.runrev.com/mailman/listinfo/metacard
Re: Format question
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 Hellothere 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 I'd (in pseudo-code) put empty into newscript repeat for each line in orgscript repeat until found all quote pairs find first and 2nd quote of each quote pair in the line using offset and shifting the beginchar* replace all spaces between quotes with special char that is not used end repeat put the line and cd after newscript end repeat delete last char of newscript repeat whileis in text global replace ofto in newscript end repeat replace the special char with space in nerwscript * alternative is to keep replacing each quote with another character, tracking its location whether it is the first or second quote in pair instead of fiddling with beginchar and then replace this char in the very end with quote -- this would made the scripting simpler me thinks because the offset would always be from the beginning of line Robert Brenstein ___ metacard mailing list [EMAIL PROTECTED] http://lists.runrev.com/mailman/listinfo/metacard