// =========================================================================== // Copyright 2018 Autodesk, Inc. All rights reserved. // // Use of this software is subject to the terms of the Autodesk license // agreement provided at the time of installation or download, or which // otherwise accompanies this software in either electronic or hard copy form. // =========================================================================== // // // Creation Date: Sept 9, 2005 // // Description: // This procedure searches for and returns the menu object with the given // label in the given menuSet. // global proc string findMenuFromMenuSet( string $menuSet, string $label ) // // Description: // This procedure searches for and returns the menu object with the given // label (in the menuBar) in the given menuSet. // // Arguments: // string $menuSet the menuSet object to search in. (see findMenuSetFromLabel()) // string $label the label of the menuSet to be found // // Return: // the men object name of the menu with that label or an empty string // if there is none // { // change to the new menuSet, and get the list of menus in the set string $menusArray[] = `menuSet -q -menuArray $menuSet`; int $i; int $menusArraySize = size($menusArray); $lowerLabel = `tolower $label`; // go through all the menus in the set ... for ($i = 0; $i < $menusArraySize; $i++) { if (`menu -q -exists $menusArray[$i]`) { string $lbl = `menu -q -l $menusArray[$i]`; $lbl = `tolower $lbl`; // ... and compare the labels if ($lowerLabel == $lbl) { // if menu found, return the menu obj name return $menusArray[$i]; } } } // if we get to this point, then we can not find a menu with the // specified label. So we return an empty string. // return ""; }