Creating Indexes via Macro

Is there a way to create indexes (or attributes, etc.) using a macro? I want to create indexes for every FK in each table and have them named properly. I have gotten several rename macros to work well but not sure how to go about creating new things in the model. Thanks.


at the following page you can find a script that creates index for autoincrement attributes:

You can use it for inspiration.

Extract from the script where you can see how to create new index via script:

Index = Entity.CreateNewObject( 2012 );
//Create new Index (2012 is object type of PERIndex)
Index.Name = IndexName;
IndexItem = Index.CreateNewObject( 2013 );
//Create new Item of Index (2013 is object type of PERIndexItem)
IndexItem.Attribute = Attribute;

Feel free to write me back in case you need my help with modifications.