all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* How I run org-agenda -csv to create data for my ListPro program
@ 2007-09-29  8:33 Charles Cave
  2007-09-29 17:55 ` Jason F. McBrayer
  0 siblings, 1 reply; 2+ messages in thread
From: Charles Cave @ 2007-09-29  8:33 UTC (permalink / raw)
  To: emacs-orgmode

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";

^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: How I run org-agenda -csv to create data for my ListPro program
  2007-09-29  8:33 How I run org-agenda -csv to create data for my ListPro program Charles Cave
@ 2007-09-29 17:55 ` Jason F. McBrayer
  0 siblings, 0 replies; 2+ messages in thread
From: Jason F. McBrayer @ 2007-09-29 17:55 UTC (permalink / raw)
  To: Charles Cave; +Cc: emacs-orgmode

Charles Cave <charles_cave@optusnet.com.au> writes:

> 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.

Nifty.  I use something similar in Python for "syncing" with my paper
notebook by generating pdfs of my custom agendas.

-- 
+-----------------------------------------------------------+
| Jason F. McBrayer                    jmcbray@carcosa.net  |
| If someone conquers a thousand times a thousand others in |
| battle, and someone else conquers himself, the latter one |
| is the greatest of all conquerors.  --- The Dhammapada    |

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2007-09-29 17:55 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2007-09-29  8:33 How I run org-agenda -csv to create data for my ListPro program Charles Cave
2007-09-29 17:55 ` Jason F. McBrayer

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.