local integer ribbon_tag; local integer current_menu_tag, extender_window_tag, additional_menu_tag; local integer count, i, additional_items_count, x, additional_menu_item_tag,j,k; local string additional_menu_item_name; local string mod_str; local long shortcut_key, modifier; {Get the tag for the ribbon command list on THIS target window} ribbon_tag = Window_GetRibbonCommandTag(window SOP_Entry of form SOP_Entry); {spin through the SOP command menu, Actions, Options, View, etc looking for Additional } count = CommandList_NumCommands(ribbon_tag); for i = 1 to count do additional_menu_tag = CommandList_GetCommandByPosition(ribbon_tag, i); if Command_GetStringProperty(additional_menu_tag,COMMAND_PROP_DISPLAY_NAME) = "Additional" then {the above was the Additional menu group. Now need to get the Additional menu command list itself. Just re-use that variable} additional_menu_tag = CommandList_GetCommandByPosition(additional_menu_tag, 1); {now look through all of the items on the Additional command list itself} additional_items_count = CommandList_NumCommands(additional_menu_tag); for x = 1 to additional_items_count do additional_menu_item_tag = CommandList_GetCommandByPosition(additional_menu_tag, x); additional_menu_item_name = Command_GetStringProperty(additional_menu_item_tag,COMMAND_PROP_DISPLAY_NAME) ; Command_GetAccelerator(additional_menu_item_tag, modifier, shortcut_key); if shortcut_key > 0 then mod_str = ""; {find out what modifier key Control/Alt/Shift...} case modifier in [COMMAND_SHORTCUT_CTRL] mod_str = "Ctrl+"; in [COMMAND_SHORTCUT_CTRLSHIFT] mod_str = "Ctrl+Shift+"; in [COMMAND_SHORTCUT_CTRLALT] mod_str = "Ctrl+Alt+"; in [COMMAND_SHORTCUT_ALT] mod_str = "Alt+"; in [COMMAND_SHORTCUT_ALTSHIFT] mod_str = "Alt+Shift+"; in [COMMAND_SHORTCUT_CTRLALTSHIFT] mod_str = "Ctrl+Alt+Shift+"; end case; {and then the accelerator key and combine them} case shortcut_key in [112 to 123] {F1 to F12} mod_str = mod_str + "F"+str(123-shortcut_key); else {is letter/number} mod_str = mod_str + char(integer(shortcut_key)); end case; {modify the menu name string string with accelerator keys added} additional_menu_item_name = additional_menu_item_name + CH_SPACE + "(" + mod_str + ")"; {change the menu name to be the new name with accel keys added} Command_SetStringProperty(additional_menu_item_tag,COMMAND_PROP_DISPLAY_NAME, additional_menu_item_name); end if; end for; end if; end for;