Enumerate MoI commands from a startup script?

 From:  Michael Gibson
10349.2 In reply to 10349.1 
Hi Larry,

re:
> Seems like I ought to be able to get there by walking though the SidePanePalettes but
> I haven't quite figured out how to do that. Or maybe there is a better way?

You could try the same way that Max's script menu does it which is by getting the commands folder using:
code:
var dir = moi.filesystem.getCommandsDir();


And then you can iterate through all files ending in .js in that directory using:
code:
var files = moi.filesystem.getFiles( dir, '*.js' );


Going through the buttons in the side pane would be something like this:

code:
var buttons = moi.ui.sidePane.document.getElementsByTagName( 'moi:CommandButton' );

for ( var i = 0; i < buttons.length; ++i )
{
    var command = buttons.item(i).getAttribute( 'command' );
}



- Michael