From mboxrd@z Thu Jan 1 00:00:00 1970 From: "Eric Schulte" Subject: Re: Org Babel, Ruby and Outlook Date: Thu, 15 Oct 2009 18:26:39 -0600 Message-ID: References: <330fb75e0910151547v3ded75f3wdd6d90f06009f558@mail.gmail.com> Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Return-path: Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1Myaei-00054F-5V for emacs-orgmode@gnu.org; Thu, 15 Oct 2009 20:26:52 -0400 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1Myaec-00053Q-Os for emacs-orgmode@gnu.org; Thu, 15 Oct 2009 20:26:50 -0400 Received: from [199.232.76.173] (port=42800 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1Myaec-00053N-Io for emacs-orgmode@gnu.org; Thu, 15 Oct 2009 20:26:46 -0400 Received: from mail-pz0-f190.google.com ([209.85.222.190]:56399) by monty-python.gnu.org with esmtp (Exim 4.60) (envelope-from ) id 1Myaec-0007Jj-7k for emacs-orgmode@gnu.org; Thu, 15 Oct 2009 20:26:46 -0400 Received: by pzk28 with SMTP id 28so1217899pzk.27 for ; Thu, 15 Oct 2009 17:26:45 -0700 (PDT) In-Reply-To: <330fb75e0910151547v3ded75f3wdd6d90f06009f558@mail.gmail.com> (Miguel Fernando Cabrera's message of "Thu, 15 Oct 2009 17:47:01 -0500") List-Id: "General discussions about Org-mode." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org Errors-To: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org To: Miguel Fernando Cabrera Cc: Org Mode Hi Miguel, That is a very cool application. To insert your script's results directly into the Org-mode buffer try changing your header line from #+begin_src ruby :results output to #+begin_src ruby :results output raw as this seems like the sort of thing which would be generally useful, would you mind if it is added to the "Library of Babel"? Best -- Eric Miguel Fernando Cabrera writes: > Hi All, > > In a similar way to=C2=A0 [1],=C2=A0 I want to import my Outlook appointm= ents into Org. I thought of a less > sophisticated way to archive this using Org Babel. > I coded a Ruby script to "print out"=C2=A0 the Appointments in Org Format= so I can see them in the agenda > view.=C2=A0 I execute the code using the ":results output" header option = to get the output from the ruby script > (check the script below). > > Now, the only problem is that the output of the script is always surround= ed by=C2=A0 #+begin_example and # > +end_example. I was wondering if there is a way to prevent this. What I w= ant is=C2=A0 the text lines to be put > on the Org buffer so Org can interpret them as headlines. > > Also, I tried to get the output using a vector (value mode), but for some= reason I was getting "End of > File During Parsing" message when executing the script. I think it has to= be with some characters in the > Subject properties of the Outlook appointments. > > Any help will be really appreciated. > > [1] http://osdir.com/ml/emacs-orgmode-gnu/2009-04/msg00264.html > > -------------------------------------------------------------------------= ---------------------------------------- > > #+begin_src ruby :results output > =C2=A0 require 'win32ole' > =C2=A0 > =C2=A0 def to_org_date(otStr) > =C2=A0=C2=A0=C2=A0 "<%s>" % otStr.gsub("/","-") > =C2=A0 end > =C2=A0 > =C2=A0 def to_org_interval(start,endd) > =C2=A0=C2=A0=C2=A0 to_org_date(start)+"--"+to_org_date(endd) > =C2=A0 end > =C2=A0 > =C2=A0 outlook =3D WIN32OLE.new('Outlook.Application') > =C2=A0 > =C2=A0 mapi =3D outlook.GetNameSpace('MAPI') > =C2=A0 calendar =3D mapi.GetDefaultFolder(9) > =C2=A0 puts "* OUTLOOK APPOINTMENTS" > =C2=A0 calendar.Items.each do |appt| > =C2=A0=C2=A0=C2=A0 puts "** #{appt.Subject}\n #{to_org_interval(appt.Star= t,appt.End)} " > =C2=A0 end > #+end_src > > -------------------------------------------------------------------------= ----------------------------------- > > -- > Miguel Fernando Cabrera Granados > http://mfcabrera.com > "A los hombres fuertes les pasa lo que a los barriletes; se elevan cuando= es > mayor el viento que se opone a su ascenso." - Jos=C3=A9 Ingenieros > > _______________________________________________ > Emacs-orgmode mailing list > Remember: use `Reply All' to send replies to the list. > Emacs-orgmode@gnu.org > http://lists.gnu.org/mailman/listinfo/emacs-orgmode