freko12 Posted April 24, 2022 Share Posted April 24, 2022 (edited) Hi, I have been struggling with this for the past 2 days. I need help in returning the name of the selected item in an ordered menu. What I am trying to achieve is to dynamically populate the ordered menu with the list of projects via menu scrip (python) import os path="k:/Projects/" dirList = os.listdir(path) dirs = [] for dirName in dirList: fullPath = os.path.normpath(os.path.join(path, dirName)) if os.path.isdir(fullPath): #dirs += [fullPath, dirName] dirs += [dirName, dirName] return dirs This code scans for folders in directory(k:/Projects/) and lists them in the menu. All works fine till here. Now I need to return the name value of the selected menu item from another parameter. So I have tried this listItemName = hou.pwd().parm("parmList_Projects").eval() and this listItemName = hou.pwd().parm("parmList_Projects").evalAsString() but it returns only integer values from (0,1,2,...) How can I get the name or label value ? Edited April 24, 2022 by freko12 Quote Link to comment Share on other sites More sharing options...
Stalkerx777 Posted April 25, 2022 Share Posted April 25, 2022 It's easier to use a String type parameter (with a menu) for this instead of ordered menu. This way, eval() will return a string. 1 Quote Link to comment Share on other sites More sharing options...
freko12 Posted April 25, 2022 Author Share Posted April 25, 2022 3 hours ago, Stalkerx777 said: It's easier to use a String type parameter (with a menu) for this instead of ordered menu. This way, eval() will return a string. Wow it worked like a charm. How come I overlooked this! Thanks a ton Stalkerx777 Cheers! 1 Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.