From: Charles Cave <charles_cave@optusnet.com.au>
To: emacs-orgmode@gnu.org
Subject: How I run org-agenda -csv to create data for my ListPro program
Date: Sat, 29 Sep 2007 18:33:07 +1000 [thread overview]
Message-ID: <46FE0DC3.4090206@optusnet.com.au> (raw)
I wanted to show how I use the org-batch-agenda-csv command
to create a file to import into the ListPro program
that I run on my Palm M515 handheld.
ListPro is from http://www.iliumsoft.com
In my .emacs file I have this helper function:
(defun org-csv-agenda ()
(org-batch-agenda-csv "H")
)
The H refers to a prestored command:
("H" "Home NA Lists"
((agenda)
(tags-todo "HOME")
(tags-todo "COMPUTER")
(tags-todo "OFFICE")
(tags-todo "DVD")
(tags-todo "READING")))))
I run a Perl script "agen2lpro.pl" that runs the helper function,
captures the comma-separated output into a file, then processes
this file to create a tab-delimited file for importing into ListPro.
I manage my lists on the Palm and synchronise back to my Windows
Machine. The ListPro list can be exported to a tab delimited
and processed with another Perl script, but I don't attempt to
do any updating of the original org-mode file marking completed
items, but that is planned for the future.
Here is the Perl script
use strict;
use warnings;
my $emacs_exe = "\"D:\\Program
Files\\emacs_22\\emacs-22.1\\bin\\emacs.exe\"";
my $work_file = "agenwork.txt";
print "Create CSV file using Emacs\n";
my $cmd = system("$emacs_exe --batch -l c:/homes/charles/.emacs -f
org-csv-agenda > $work_file");
print "$work_file (workfile) Created.\nProcessing ...\n";
# The output of this script is a tab delimited file to import
# into ListPro. The fields are
#
# Description
# Category (OFFICE, HOME, DVD, or READING)
# Date - Either the scheduled date or blank.
# DateLoaded - Todays date in month and day format in order to
# identify Listpro items that originated from org-mode
my $listpro = "listpro.txt";
open (my $fv, "<", $work_file) or die "Could not open $work_file: $!\n";
open (my $of, ">", $listpro) or die "Could not create $listpro: $!\n";
my @ltime = localtime();
my $datestring = sprintf("%d%d" , $ltime[4] + 1, $ltime[3] );
print "Version string $datestring\n";
my ($category, $headline, $type, $todo, $tags, $date, $time, $extra,
$priority_l, $priority_n);
while(<$fv>) {
chomp;
($category, $headline, $type, $todo, $tags, $date, $time, $extra,
$priority_l, $priority_n) = split(/,/);
if ($tags =~ m/^([A-Za-z]+):/) {
$tags = $1;
}
$tags = uc($tags);
if ( ($type eq "scheduled") or ($type eq "typestamp") ) {
my @d = split(/-/, $date); # orgmode used YYYY-M-DD format
my $newdate = $d[2]."/".$d[1]."/".$d[0];
print $of "$headline\t$tags\t$newdate\t$datestring\n";
}
if ( $type eq "tagsmatch" ) {
print $of "$headline\t$tags\t\t$datestring\n";
}
}
print "Finished! Now load the file $listpro into Listpro\n";
next reply other threads:[~2007-09-29 8:33 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2007-09-29 8:33 Charles Cave [this message]
2007-09-29 17:55 ` How I run org-agenda -csv to create data for my ListPro program Jason F. McBrayer
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
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=46FE0DC3.4090206@optusnet.com.au \
--to=charles_cave@optusnet.com.au \
--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 external index
https://git.savannah.gnu.org/cgit/emacs.git
https://git.savannah.gnu.org/cgit/emacs/org-mode.git
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.