Greetings all. I've written a simple utility that takes a TAB-delimited line of text and converts it to ":" delimited text.
In other words, if I send this:
"2 UL BASKETBALL 99 DEL MONTE TOMATOES - VARIOUS"
This is the result:
"2:UL BASKETBALL 99:DEL MONTE:TOMATOES - VARIOUS"
It works fine until I try to send a group of lines to it.
Here's the code for the util.:
on createList (newText)
set delList = ""
--begin repeat loop to cycle through entire line of text
repeat with j = 1 to newText.chars.count
set newC = char j of newText
--test each char for SPACE(" "). If SPACE, then keep count.
--If current char is a " " AND the NEXT char isn't, then add a " " between 'words'.
if newC = " " then
set sp = sp + 1
if sp = 1 AND char (j+1) of newText <> " " then
put " " after delList
end if
--if Space count is 4(TAB), then insert ":" and reset counter
if sp = 4 then
put ":" after delList
set sp = 0
end if
--if current char isn't a SPACE, then add current char and reset Space counter
else
put newC after delList
set sp = 0
end if
end repeat
put delList --for testing purposes only!
end
I have no problem with this code working. On individual lines of text it works fine (also realizing that this is written to recognize TABs that Director sees as 4 spaces--not very versatile yet, but works for what I need it to).
I'm wondering if my problem is coming from the invisible RETURN key that separates the records in the text file. If I have a text field that contains my data (say "tabText")--put the text from the field into a variable(say "newData") and then try to run a simple script like this...
on mouseUp
newData = member ("tabText").text
repeat with j = 1 to member("tabText").line.count
set newLine = line j of newData --not sure of dot syntax for this
createList(newLine) --send line 1 to utility, then line 2...so on.
end repeat
end
...I get absolutely NO affect! It seems to completely ignore the function!?
I've been looking at this and fighting with it for about 6 hrs. now and am probably just overlooking something simple. Any help would be appreciated.
BTW, Dir 7 running on PC.
TIA
Mike Cash
Get your FREE download of MSN Explorer at http://explorer.msn.com
[To remove yourself from this list, or to change to digest mode, go to http://www.penworks.com/LUJ/lingo-l.cgi To post messages to the list, email [EMAIL PROTECTED] (Problems, email [EMAIL PROTECTED]) Lingo-L is for learning and helping with programming Lingo. Thanks!]
