emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
From: Miguel Fernando Cabrera <mfcabrera@gmail.com>
To: Org Mode <emacs-orgmode@gnu.org>
Subject: Org Babel, Ruby and Outlook
Date: Thu, 15 Oct 2009 17:47:01 -0500	[thread overview]
Message-ID: <330fb75e0910151547v3ded75f3wdd6d90f06009f558@mail.gmail.com> (raw)


[-- Attachment #1.1: Type: text/plain, Size: 1982 bytes --]

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 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
  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 = WIN32OLE.new('Outlook.Application')

  mapi = outlook.GetNameSpace('MAPI')
  calendar = 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

------------------------------------------------------------------------------------------------------------


-- 
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é Ingenieros

[-- Attachment #1.2: Type: text/html, Size: 2342 bytes --]

[-- Attachment #2: Type: text/plain, Size: 204 bytes --]

_______________________________________________
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

             reply	other threads:[~2009-10-15 22:47 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-10-15 22:47 Miguel Fernando Cabrera [this message]
2009-10-16  0:26 ` Org Babel, Ruby and Outlook Eric Schulte

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.orgmode.org/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=330fb75e0910151547v3ded75f3wdd6d90f06009f558@mail.gmail.com \
    --to=mfcabrera@gmail.com \
    --cc=emacs-orgmode@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).