Problem with loop of array elements
Thomas Fischer
fischer at mail.sub.uni-goettingen.de
Tue Nov 15 09:58:01 EST 2005
Hello,
I have a small script that extracts URLs from an HTML page (see below).
This works nicely if I do it step by step using the debugger.
But if I let it run, I get only every other URL with blank lines in between.
Does anybody have an idea what's going on?
Thomas
---
on mouseUp
put cd fld "SaveFile" into theSearchFile
open file theSearchFile
read from file theSearchFile until end
close file theSearchFile
put it into theSearchResult
get 1
repeat while numToChar(it) is in theSearchResult
add 1 to it
end repeat
replace "<p class=g>" with numToChar(it) in theSearchResult
split theSearchResult by numToChar(it)
put empty into theSearchResult[1]
put empty into foundURLs
repeat for each element foundURL in theSearchResult
split foundURL by quote
put foundURL[2] & return after foundURLs
end repeat
repeat while char 1 of foundURLs is return
delete char 1 of foundURLs
end repeat
put "file:" & theSearchFile & "-Links" into theSearchFile
put foundURLs into URL theSearchFile
end mouseUp
--
Thomas Fischer
Salzburg
More information about the use-livecode
mailing list