Collect Projectmap, Customer and Reference out of PathName

In a PathName for example:

C:\\production\\cad\\projects 2011\\P110001 - Customer - Reference

I like to collect 'P110001' as project number, 'Customer' as customer and 'Reference' as customers reference.

How can I create a code that is looking start to the left for 'P1' till '-' in the Pathname and so on for customer and reference.

Next thing is to create the custom property, I think I know how, it's in the help file.

I'm trying to put this in a macro to create the custom properties based on the main projectmap.

Greetings !

SolidworksApi macros