Re: "Next" in Repeat?
Re: "Next" in Repeat?
- Subject: Re: "Next" in Repeat?
- From: Steve Ivy <email@hidden>
- Date: Tue, 23 Jan 2001 11:40:21 -0500
on 1/23/01 10:59 AM, JollyRoger at email@hidden wrote:
>
>
Why not just:
>
>
repeat with i in {1,2,3}
>
if i is not "2"
>
log (i)
>
end if
>
end repeat
[snip]
Because that was simple example - what I'm doing is somewhat more complex.
I have a script that works with Aportis Tech's outliner, Brainforest. I
start with an outline of xml-based news sources online (RSSS files) and the
script walks the list, getting the url from BrainForest's notes field on the
outline heading, and downloads each file. It then parses the XML using Late
Night Software's XML Tools, and creates a sub-outline under the current
heading that lists all the current news headings.
Now - I ran into a source today whose XML was malformed, and I got a parse
error. I wanted to catch the error (in a try block), insert an error msg,
and go on to the next source. I would have liked to do (pseudocode):
-------------------------
repeat with node in rssSourceNodes
--get url
--download and read into string
try
--parse xml
on error -- couldn't parse
--insert err_msg
next repeat
end try
--process if it works
end repeat
--------------------------
instead i've done this:
--------------------------
-- parse xml
set parseOK to true
try
set xmlData to parse XML (xmlStr)
on error err_msg number err_num
tell rsf to set newNode to make new tree item at end of sourceNode with
properties {title:"Error: " & err_num & "; " & err_msg}
set parseOK to false
end try
----------------------------------
if parseOK then
--process
-- 50 or so lines of processing
end if
--------------------------
This just seemed a bit kludgy.
--Steve
>
JR
>
_______________________________________________
>
applescript-users mailing list
>
email@hidden
>
http://www.lists.apple.com/mailman/listinfo/applescript-users