Table.Concat not working with FileMenu?

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts
  • SonG0han
    Forum Member
    • Dec 2003
    • 163

    Table.Concat not working with FileMenu?

    Hi! I tried to get the Menubar in a var(table) and then display the content as string in a textbox but I get this runtime error.

    [3]: tblFileMenu = Application.GetMenu();
    TRACE: LastError = 0 ("Success.")
    [2]: result = Table.Concat(tblFileMenu, ";", 1, TABLE_ALL);
    TRACE: LastError = 2901 ("A runtime error occurred while calling the function.")
    [4]: Input.SetText("Input1", result);
    TRACE: LastError = 0 ("Success.")

    Does anyone know why it does not work?
  • madsen
    Indigo Rose Customer
    • Jun 2004
    • 77

    #2
    This is basically from the help file I tested it and works on AMS7 here.

    Code:
    -- Output all top level menu items:
    local strMenuData = "";
    
    -- Store the contents of the menu in a table
    tblMenu = Application.GetMenu();
    
    -- Check that the table exists
    if(tblMenu)then
      local nNumItems = Table.Count(tblMenu);
    
      -- Step through the table row by row
      for index = 1, nNumItems do
          local tblItemInfo = tblMenu[index];
          if(tblItemInfo)then
              -- Add the text to the string
              strMenuData = strMenuData..tblItemInfo.Text.."\r\n";
          end
      end
    
      -- Output the created string to the user
    Input.SetText("Input1", strMenuData);
    end
    I added the Input field for the sake of this example.
    Human Relativity: No one is alike, which is what makes us alike, at any given time. --Myself

    Comment

    Working...
    X