Open directory
Hi all. I'm making a dynamic menu bar in maxscript. I'm having a little bit of trouble opening up the right file path. I'm looking through folders then wanting to open the directories in the right place.
in short this is what I'm having trouble with:
str = "macroscript smartmenu_scene" + (ii as string) + " category:\"smartmenu_scene\" buttontext:\"" + (getFilenameFile i) + "\" (getOpenFileName filename:scenefilepather \"" + i + "\")" execute str
Here is the whole script for a little more reference:
------------------------------------------------------------------------------------------------------------------------------ --Project Grabber ------------------------------------------------------------------------------------------------------------------------------ ProjectPath = "C:\3dsmax2013\3ds Max 2013\scripts\Project Manager\CurrentPrj.txt" ProjectText = openFile (ProjectPath)mode:"r" while NOT eof ProjectText do oReadLine = readLine ProjectText --filepath.caption = oReadline close ProjectText scenefilepather = "G:\\" + oReadline + "\\B_JOBS\\06_15137_CENTRE_POINT_SET_06_INTERIORS_AMENITY\\02_PRODUCTION\\" dirArray = GetDirectories (scenefilepather+"/*") --//Get subfolders in directory scene_files = for d in dirArray collect (trimright (filenameFromPath d) "\\") print scene_files sort scene_files xreffilepather= "G:\\" + oReadline + "\\C_MASTER_FILES\\02_XREFS\\*.max" xref_files = getFiles xreffilepather sort xref_files ------------------------------------------------------------------------------------------------------------------------------ --Destroy Menu ------------------------------------------------------------------------------------------------------------------------------ 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" --create a SubMenu menu 1 scenesubMenu = menuMan.createMenu "Scene" ii = 0 for i in scene_files do ( ii = ii + 1 bobby = scenefilepather + i + "\\02_3D\\" str = "macroscript smartmenu_scene" + (ii as string) + " category:\"smartmenu_scene\" buttontext:\"" + (getFilenameFile i) + "\" (getOpenFileName filename:scenefilepather \"" + i + "\")" execute str MenuItemone = menuMan.createActionItem ("smartmenu_scene" + (ii as string)) "smartmenu_scene" scenesubMenu.addItem MenuItemone -1 ) --create a SubMenu menu 2 xrefsubMenu = menuMan.createMenu "Xref" ii = 0 for i in xref_files do ( ii = ii + 1 str = "macroscript smartmenu_xref" + (ii as string) + " category:\"smartmenu_xref\" buttontext:\"" + (getFilenameFile i) + "\" (loadMaxFile \"" + i + "\")" execute str MenuItemtwo = menuMan.createActionItem ("smartmenu_xref" + (ii as string)) "smartmenu_xref" xrefsubMenu.addItem MenuItemtwo -1 ) --create a Menu Item holding that menu subMenuItemscene = menuMan.createSubMenuItem "Scene" scenesubMenu subMenuItemxref = menuMan.createSubMenuItem "Xref" xrefsubMenu --add it to our new menu in the 1st position newMenu.addItem subMenuItemscene 1 newMenu.addItem subMenuItemxref 2 --get the Main Menu mainMenu = menuMan.getMainMenuBar() --find last item + 1 menuPos = mainMenu.numItems() + 1 --create a Menu Item for the new menu newMenuItem = menuMan.createSubMenuItem "ADC Manager" newMenu --add it to the main menu mainMenu.addItem newMenuItem menuPos --update the main menu to reflect the changes menuMan.updateMenuBar() )
Anyone got any ideas why it won't drill down a folder?
Comments
.
I don't have max to test, but try with this:
Tools and Scripts for Autodesk 3dsMax