Folder browser menu

Hi All,

I'm trying to create a folder menu browser. This might be a little difficult to understand from the code. But what is happening is the second and third etc menus aren't been created. They are just displaying what is in the first loop. If any one could have a look and help that would be great.

if ((menuMan.findMenu "ADC Manager") != undefined) then 
(
	menuMan.unRegisterMenu (menuMan.findMenu "ADC Manager")
	menuMan.updateMenuBar()
)
(
 
------------------------------------------------------------------------------------------------------------------------------
--Menu
------------------------------------------------------------------------------------------------------------------------------
 
--create a Menu to add onto the main menu bar
newMenu = menuMan.createMenu "ADC Manager"
 
------------------------------------------------------------------------------------------------------------------------------
--Scenes
------------------------------------------------------------------------------------------------------------------------------
 
projectfilepather = "G:\\" + oReadline + "\\B_JOBS\\"
dirArrayproject = GetDirectories (projectfilepather+"/*") --//Get subfolders in directory
project_files = for d in dirArrayproject collect (trimright (filenameFromPath d) "\\")
sort project_files
 
--No need to create menu here. Just in root of the dir
aa = 0
for a in project_files do 
(
	aa = aa + 1
	projectsubMenu = menuMan.createMenu a --"Sub menus"
	MenuItemone = menuMan.createSubMenuItem (aa as string) projectsubMenu
	newMenu.addItem MenuItemone -1
 
	-------------------------------------------------------------------------------------------------
	--Sub Scene menu
	-------------------------------------------------------------------------------------------------
 
	if oReadline == "P23_CENTRE_POINT" then (
			scenefilepather = "G:\\" + oReadline + "\\B_JOBS\\" + a + "\\02_PRODUCTION\\"
			dirArrayscene = GetDirectories (scenefilepather+"/*") --//Get subfolders in directory
			scene_files = for d in dirArrayscene collect (trimright (filenameFromPath d) "\\")
	)else(
			scenefilepather = "G:\\" + oReadline + "\\B_JOBS\\" + a + "\\03_PRODUCTION\\"
			dirArrayscene = GetDirectories (scenefilepather+"/*") --//Get subfolders in directory
			scene_files = for d in dirArrayscene collect (trimright (filenameFromPath d) "\\")
	)
 
	sort scene_files
	print scene_files
	print oFruit
 
	ScenesubMenu = menuMan.createMenu "Scenes"	
	bb = 0
	for b in scene_files do 
 
	(
			bb = bb + 1
			str = "macroscript smartmenu_scene" + (bb as string) + " category:\"smartmenu_scene\" buttontext:\"" + (getFilenameFile b) + "\" (f = getOpenFileName filename:\"" + scenefilepather + b + "\\02_3D\\01_GI" +"\"; if f == undefined then print blanker else loadmaxfile f)"
			execute str
 
			subMenuItemseptesta = menuMan.createActionItem ("smartmenu_scene" + (bb as string)) "smartmenu_scene"
			newMenu.addItem subMenuItemseptesta -1
			--projectsubMenu.addItem subMenuItemseptesta -1
 
	-------------------------------------------------------------------------------------------------
	--Sub Scene Filesmenu END
	-------------------------------------------------------------------------------------------------			
	)
	-------------------------------------------------------------------------------------------------
	--Sub Scene Filesmenu END
	-------------------------------------------------------------------------------------------------
)
<\code>