CSV 2 Structure Plugin (Composition by benoitlahoz)

Author: benoitlahoz
License: Public Domain
Date: 2011.06.06
Compatibility: 10.6
Categories:
Required plugins:
(none)

Hi !

As I wanted to manage with 'states/events' with the Kinect I made this little plugin based upon the Danilo Campos CSV Parser (http://blog.danilocampos.com/).

It takes a CSV file (with comma, semicolon or tab delimiter) and output a structure with strings, numbers and colors.

For colors, insert "RGBA" at the end of your header, then insert RGBA values separated by a blank space in your fields.

I have troubles with UTF8 so it doesn't accept special characters (especially... not French special characters). Changing the encoding while parsing the file doesn't change anything, except... crash...

Source code and plugin included in the next post.

Comment viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.

benoitlahoz's picture
Re: CSV 2 Structure Plugin (Composition by benoitlahoz)

Here are the plugin and source code. Some other work to do on it...

PreviewAttachmentSize
CSV2Structure.zip44.43 KB

dust's picture
Re: CSV 2 Structure Plugin (Composition by benoitlahoz)

nice. so i can use this to parse my email contacts with or is it just for colors ?

benoitlahoz's picture
Re: CSV 2 Structure Plugin (Composition by benoitlahoz)

Yes. Actually it doesn't parse well UTF-8 files (if you have french contacts for example !) even if I change the encoding in the source. I may modify the parser or change for a plain Objective-C one... There's a good one there : http://www.macresearch.org/cocoa-scientists-part-xxvi-parsing-csv-data

dust's picture
Re: CSV 2 Structure Plugin (Composition by benoitlahoz)

yeah i get (see below) when i try my contacts

 *** -[NSCFArray objectAtIndex:]: index (88) beyond bounds (88)
. i don't have any´´´´´´ it goes name,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,then some more commas,,,,,,,,,,,,,,,,,,,, yes even more,,,,,,,,,,,,,, then finally email 

benoitlahoz's picture
Re: CSV 2 Structure Plugin (Composition by benoitlahoz)

Would you send an example CSV (with fake contact, obviously) ? Thanks !

dust's picture
Re: CSV 2 Structure Plugin (Composition by benoitlahoz)

my contacts look like this..

Mark -Customer,,Support,,,,,,,,,,,,mad@finaldraft.com,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,Normal,,,

never mind i just took this crap out of top of my contact list and it works.

First Name,Middle Name,Last Name,Title,Suffix,Initials,Web Page,Gender,Birthday,Anniversary,Location,Language,Internet Free Busy,Notes,E-mail Address,E-mail 2 Address,E-mail 3 Address,Primary Phone,Home Phone,Home Phone 2,Mobile Phone,Pager,Home Fax,Home Address,Home Street,Home Street 2,Home Street 3,Home Address PO Box,Home City,Home State,Home Postal Code,Home Country,Spouse,Children,Manager's Name,Assistant's Name,Referred By,Company Main Phone,Business Phone,Business Phone 2,Business Fax,Assistant's Phone,Company,Job Title,Department,Office Location,Organizational ID Number,Profession,Account,Business Address,Business Street,Business Street 2,Business Street 3,Business Address PO Box,Business City,Business State,Business Postal Code,Business Country,Other Phone,Other Fax,Other Address,Other Street,Other Street 2,Other Street 3,Other Address PO Box,Other City,Other State,Other Postal Code,Other Country,Callback,Car Phone,ISDN,Radio Phone,TTY/TDD Phone,Telex,User 1,User 2,User 3,User 4,Keywords,Mileage,Hobby,Billing Information,Directory Server,Sensitivity,Priority,Private,Categories
,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,Apple Inc.,,,,,,,"1 Infinite Loop
Cupertino,  CA  95014
United States",,,,,,,,,1-800-MY-APPLE,,,,,,,,,,,,,,,,,,,,,,,,,,,Normal,,My Contacts,

to many ,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,, i can not find and replace all them will have to edit them out..

thanks for sharing

benoitlahoz's picture
Re: CSV 2 Structure Plugin (Composition by benoitlahoz)

Yes, I forgot to say that it's necessary to make headers (which are keys for each 2nd degree output structure).