how to get the "label" of an item in ordered menu

   2558   1   1
User Avatar
474 posts
Joined: Dec. 2009
I have an ordered menu with each of its “Token” associated with a string “Label”. (image 08 )

May I ask how can I use either Hscript or Python to get the Label string once I select an item from the menu?

I tried the following but it always return the numerical index or the token value of the menu item selected … (image 09 & 10)

Thank you very much!

08.JPG (56.0 KB)
09.JPG (16.0 KB)
10.JPG (13.1 KB)

It's always a pleasure to learn from you!
User Avatar
3156 posts
Joined: July 2007
something like this:
parm = hou.pwd().parm(“case_name_list”)
value = str(parm.eval()) # convert to string since you have ordered menu
if value in parm.menuItems():
index = parm.menuItems().index(value)
return parm.menuLabels()
return “value %s not found in menu” % value
Tomas Slancik
FX Supervisor
Method Studios, NY
  • Quick Links