Hi, I'm a total ruby noob but i've obtained this script from another
forum over at Tracks. I'm trying to extract some info from a plain text
feed of my upcoming calendar events and write specific info to three
different text files (today, tomorrow, and next 7 days). I'm on a Mac.

The script is here: I've already made edits specific to my computer (the
address of my text feed for example):

#!/usr/bin/ruby
#Generate3seperatetextfilesfromTracksTXTfeeds
#listingactionsduetoday(oroverdue),tomorrowor
#inthenext7days.
#YoucanthenpullthesetextfilesintoGeekToolandcolour
#themseparately.

#========Constantstosetwithyourvalues===============
#
#URLforthebasefeed:http://yourdomain.tld/feed/text/[token]
URL="http://0.0.0.0:3000/feed/text/Nathan/b0b2a7c81680d1a1920b199ecb6db0ad86e2e984"
#Pathtotemporarydirectory
TEMP_DIR="/Users/"
#
#=============================================
#Grabeachfeed,splitintolines,thengetridofanynon-actionlines
today=`curl-s"#{URL}"?due=0`.split("\n").select{|line|line=~/\s+\[Due:/orline=~/^\w/}
tomorrow=`curl-s"#{URL}"?due=1`.split("\n").select{|line|line=~/\s+\[Due:/orline=~/^\w/}
this_week=`curl-s"#{URL}"?due=6`.split("\n").select{|line|line=~/\s+\[Due:/orline=~/^\w/}

#Getridofrepeatedactionsintomorrowandthis_week
tomorrow=tomorrow-today
today_or_tomorrow=today+tomorrow
this_week=this_week-today_or_tomorrow

#Printtheinfotothreefiles,storedinTEMP_DIR
file=File.new("#{TEMP_DIR}/today.txt","w")
file.print"\nToday:\n"+today.join("\n")
file.close

file=File.new("#{TEMP_DIR}/tomorrow.txt","w")
file.print"\nTomorrow:\n"+tomorrow.join("\n")
file.close

file=File.new("#{TEMP_DIR}/later.txt","w")
file.print"\nLater:\n"+this_week.join("\n")
file.close

When I run this from BBEdit I get about 50 lines of this:

untitled text:11: Invalid char `\302' in expression
untitled text:11: Invalid char `\240' in expression
untitled text:11: Invalid char `\302' in expression
untitled text:11: Invalid char `\240' in expression
untitled text:13: Invalid char `\302' in expression
untitled text:13: Invalid char `\240' in expression
untitled text:13: Invalid char `\302' in expression
untitled text:13: Invalid char `\240' in expression
untitled text:17: Invalid char `\302' in expression
untitled text:17: Invalid char `\240' in expression
untitled text:17: Invalid char `\302' in expression
untitled text:17: Invalid char `\240' in expression


Any ideas? Sorry if this appears obvious. Many thanks.
-- 
Posted via http://www.ruby-forum.com/.