Detect/list instances on stage, create menu

Hi there, for a project i need to have a script checking which instances are on the stage and then make a list of this (or populate a menu in my case). So i have multiple instances (called module1, module2 etc) and when exporting i need a menu to be generated with buttons that have the same name/text as the instances; module1 module2 etc.

Could you do something like: for every instance of moduleclass create menuitem populate textbox with samename. ?
Or do i need something else?.. helpp im freakin out