#!/usr/bin/env python """a small command-line utility for use with flauxtext on win32 with outlook. if you use outlook, you can export your outlook contacts to a CSV file. this script converts that to contacts.flauxtext format, then appends or creates contacts.flauxtext in the directory you specify. usage: python outlookCSV2flauxtext.py example: python outlookCSV2flauxtext.py C:\addies.csv "C:\program files\flauxtext" how to generate addies.csv []: """ import os,sys def outlook2flauxtext(ifn, ofd=os.path.dirname(__file__)): """ifn is the pathname to the csv generated by outlook, ofd is the directory in which to place 'contacts.flauxtext' """ i = open(ifn) o = open(os.path.join(ofd, 'contacts.flauxtext'), 'a') for a in i: o.write(i[i.index('(')+1:-3] + '\n') i.close() o.close() if __name__ == '__main__': if len(sys.argv) > 2 and os.path.isfile(sys.argv[1]) and os.path.isdir(sys.argv[2]): outlook2flauxtext(sys.argv[1], sys.argv[2]) else: print __doc__