Not shy at all...
Jeanne A. E. DeVoto
revolution at jaedworks.com
Sun Jun 6 16:45:57 EDT 2004
At 9:55 AM -0700 6/6/2004, Bob Nelson wrote:
>Two fields and two buttons so I can work through the example - the first
>field is the 'holder' of the remote URL which has been retrieved
>(Imported_Raw) and the second field will be the restructured output when I'm
>done.
>
>Here's the code, for those who want to dive deeper...
>
[...]
Using replace (instead of looping through each line) will be quite a
lot faster:
on mouseUp
put field "Imported_Raw" into rawText -- manipulations are much
faster in variables
repeat while return & return is in rawText
replace return & return with return in rawText -- nuke blank lines
end repeat
repeat while return & space is in rawText
replace return & space with return in rawText -- nuke leading space
end repeat
put rawText into field "Imported_Raw"
end mouseUp
>4. I don't see any mechanisms for determining progress of the operation --
>although I may have certainly missed something. Are there any progress
>bars, etc., that one can use in Revolution?
There's a progress bar object (actually a variant of the scrollbar).
The way to handle this is to update the bar's thumbPosition property
each time through the loop. Here's a simple example:
repeat with x = 1 to 100
set the thumbPosition of scrollbar "Progress Indicator" to x
updateCard x
-- or do whatever the loop is supposed to do
end repeat
But the script above should run fast enough that you won't need one.
>5. Looking through all the examples I can find, as well as documentation, I
>noted that there aren't many examples related to text manipulation - and
>importing/exporting text, etc., in/out of your stack. I'm sure I missed
>something on this front, as I'm sure people would be doing this all the
>time... Can anyone point me in a direction?
On the "All Documentation By Category" page, click "Text and Data
Processing" - there are a number of examples and how-tos for
importing, counting, manipulating, etc.
By the way, it's simple to strip HTML using the HTMLText property:
-- myData contains HTML:
set the HTMLText of field "Holder" to myData
put the text of field "Holder" into myData
-- myData now contains just the text
--
jeanne a. e. devoto ~ jaed at jaedworks.com
http://www.jaedworks.com
More information about the use-livecode
mailing list