Nathan Thickett-menghini <somerandom_bloke / hotmail.com> wrote:

> Many thanks, I had some success by typing out the script myself and this
> eliminated the troublesome characters. The script now runs and produces
> my three text files. I still can't get it to work as desired - it seems
> to omit the lines of the calendar that I most need, i.e. the events 
> themselves! I don't understand enough about the script to be able to fix
> it but I think the error comes where the script splits the text feeds
> into separate lines - it only seems to include the first line of the 
> feed and never more. If you fancy taking a look then by all means do but
> I appreciate you fixing my first problem.
> 
> For example, the feed for 'today' is as follows in its entirety (in the
> web browser, before ruby has touched it):
> 
> 
> CAR:
>     [17/09/2007] Car to Garage at 8.30am
> 
> 
> But the ruby script returns only:
> 
> 
> Today:
> CAR:
> 
> 
> 
> 
> Any ideas?
> 
> Attachments:
> http://www.ruby-forum.com/attachment/299/coloured_actions.rb

Well, the script is doing exactly what you're telling it to do. This
expression:

select{|line|line =~ /\s+\[Due:/ or line =~ /^\w/}

...means:

Keep only those lines that begin with the word "[Due:" (possibly after
some whitespace), or that begin with a word character (e.g. "a" or "b"
or "c"...).

Well, the first line does begin with a word character ("C" for "CAR:"),
so it's kept. But the second line does not - it begins with whitespace,
and the whitespace is not followed by the word "[Due:", so it's thrown
away.

So it seems as if the script you've adopted is inappropriate to the
format of the actual data you wish to parse.

m.
-- 
matt neuburg, phd = matt / tidbits.com, http://www.tidbits.com/matt/
Tiger - http://www.takecontrolbooks.com/tiger-customizing.html
AppleScript - http://www.amazon.com/gp/product/0596102119
Read TidBITS! It's free and smart. http://www.tidbits.com