[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Orgmode] How I run org-agenda -csv to create data for my ListPro progra
From: |
Charles Cave |
Subject: |
[Orgmode] How I run org-agenda -csv to create data for my ListPro program |
Date: |
Sat, 29 Sep 2007 18:33:07 +1000 |
User-agent: |
Thunderbird 2.0.0.6 (Windows/20070728) |
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";
- [Orgmode] How I run org-agenda -csv to create data for my ListPro program,
Charles Cave <=