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 ?