Re: Why won't this parse?
Re: Why won't this parse?
- Subject: Re: Why won't this parse?
- From: Bill Briggs <email@hidden>
- Date: Thu, 10 May 2001 22:39:04 -0300
At 9:01 AM -0700 10/05/01, David Graham wrote:
I am trying to parse a Eudora nickname file to make a list of
aliases. I wish I could just get this directly from Eudora through
AS but it's not reliable since you can't get a recently added
nickname by index ... did that make sense?
I have only read this thread just this evening, so I see that you've
got the parsing problem solved, but I think you can do this directly
from Eudora as you initially wanted to do with a LOT less code, if
you adapt to something odd that Eudora seems to want.
I've extracted just such lists from nickname files for some of my own
scripts, so I think I know where the statement "you can't get a
recently added nickname by index" comes from. The odd thing about
Eudora is that it appears to number indicies of nicknames like an
engineer; viz. starting from zero, not 1.
I'll copy a piece of code below that gets the nickname list from a
nickname file for our Mac User Group, and you'll see how the
numbering works. If I were to do the "conventional" numbering in the
repeat loop, then it appears to be unable to get the nickname for the
last person added to the file, which is likely what you were seeing.
This should solve your problem.
Eudora scripting certainly has some oddities about it, and there are
bugs, but this should not give you a problem with faulty results. It
has never screwed up for me.
- web
set theList to {}
tell application "Eudora"
set theCount to count of nicknames of nickname file "CNBMUG"
repeat with i from 0 to (theCount - 1) -- errors if you use 1
to theCount
set theName to nickname of nickname i of nickname file "CNBMUG"
copy theName to end of theList
end repeat
end tell
theList
--theCount -- comes to 170
--theName
--get count of theList -- comes to 170, but only if loop starts at 0