From mboxrd@z Thu Jan 1 00:00:00 1970 From: Miguel Fernando Cabrera Subject: Org Babel, Ruby and Outlook Date: Thu, 15 Oct 2009 17:47:01 -0500 Message-ID: <330fb75e0910151547v3ded75f3wdd6d90f06009f558@mail.gmail.com> Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="===============1833550355==" Return-path: Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1MyZ6B-00026y-DH for emacs-orgmode@gnu.org; Thu, 15 Oct 2009 18:47:07 -0400 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1MyZ66-000262-V3 for emacs-orgmode@gnu.org; Thu, 15 Oct 2009 18:47:06 -0400 Received: from [199.232.76.173] (port=33398 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1MyZ66-00025v-NV for emacs-orgmode@gnu.org; Thu, 15 Oct 2009 18:47:02 -0400 Received: from mail-yx0-f191.google.com ([209.85.210.191]:56024) by monty-python.gnu.org with esmtp (Exim 4.60) (envelope-from ) id 1MyZ66-0001id-AJ for emacs-orgmode@gnu.org; Thu, 15 Oct 2009 18:47:02 -0400 Received: by yxe29 with SMTP id 29so1260007yxe.14 for ; Thu, 15 Oct 2009 15:47:01 -0700 (PDT) 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: Org Mode --===============1833550355== Content-Type: multipart/alternative; boundary=001636ed77c5bf0e0a0476010e3c --001636ed77c5bf0e0a0476010e3c Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable Hi All, In a similar way to [1], I want to import my Outlook appointments into Org. I thought of a less sophisticated way to archive this using Org Babel. I coded a Ruby script to "print out" the Appointments in Org Format so I can see them in the agenda view. 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 surrounded by #+begin_example and #+end_example. I was wondering if there is a way to prevent this. What I want is 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 th= e 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 require 'win32ole' def to_org_date(otStr) "<%s>" % otStr.gsub("/","-") end def to_org_interval(start,endd) to_org_date(start)+"--"+to_org_date(endd) end outlook =3D WIN32OLE.new('Outlook.Application') mapi =3D outlook.GetNameSpace('MAPI') calendar =3D mapi.GetDefaultFolder(9) puts "* OUTLOOK APPOINTMENTS" calendar.Items.each do |appt| puts "** #{appt.Subject}\n #{to_org_interval(appt.Start,appt.End)} " end #+end_src ---------------------------------------------------------------------------= --------------------------------- --=20 Miguel Fernando Cabrera Granados http://mfcabrera.com "A los hombres fuertes les pasa lo que a los barriletes; se elevan cuando e= s mayor el viento que se opone a su ascenso." - Jos=E9 Ingenieros --001636ed77c5bf0e0a0476010e3c Content-Type: text/html; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable Hi All,

In a similar way to=A0 [1],=A0 I want to import my Outlook a= ppointments into Org. I thought of a less sophisticated way to archive this= using Org Babel.
I coded a Ruby script to "print out"=A0 the= Appointments in Org Format so I can see them in the agenda view.=A0 I exec= ute 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 surrou= nded by=A0 #+begin_example and #+end_example. I was wondering if there is a= way to prevent this. What I want is=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 so= me 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 Sub= ject 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
=A0 require 'win32ole'
= =A0
=A0 def to_org_date(otStr)
=A0=A0=A0 "<%s>" % ot= Str.gsub("/","-")
=A0 end
=A0
=A0 def to_org= _interval(start,endd)
=A0=A0=A0 to_org_date(start)+"--"+to_org_date(endd)
=A0 end=A0
=A0 outlook =3D WIN32OLE.new('Outlook.Application')
=A0=
=A0 mapi =3D outlook.GetNameSpace('MAPI')
=A0 calendar =3D = mapi.GetDefaultFolder(9)
=A0 puts "* OUTLOOK APPOINTMENTS"
=A0 calendar.Items.each do |= appt|
=A0=A0=A0 puts "** #{appt.Subject}\n #{to_org_interval(appt.S= tart,appt.End)} "
=A0 end
#+end_src

-------= ---------------------------------------------------------------------------= --------------------------


--
Miguel Fernando Cabrera Granados
http://mfcabrera.com
"A los hombres fuertes les pasa l= o que a los barriletes; se elevan cuando es
mayor el viento que se opone= a su ascenso." - Jos=E9 Ingenieros
--001636ed77c5bf0e0a0476010e3c-- --===============1833550355== Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Disposition: inline _______________________________________________ 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 --===============1833550355==--