GeertBellekens / Enterprise-Architect-Toolpack

Addins and tools for Sparx Systems Enterprise Architect
https://bellekens.com/product/bellekens-enterprise-architect-toolpack/
BSD 2-Clause "Simplified" License
97 stars 39 forks source link

Fail to create sub-menu when using EA-Matic with JScripts #118

Open jyt13 opened 1 year ago

jyt13 commented 1 year ago

Dear Mr. Bellekens,

I am now trying to build an add-in with JScripts in EA using EA-Matic.

When I fill the code of EA_GetMenuItems, I try to return a string array, so that I can have multiple menu options: if (MenuName == ......) { return ["A","B"] }

But it always indicates me an error message which is:

image

I would like to know how to solve this issue? I am using EA 15.2.

GeertBellekens commented 1 year ago

Not sure what is going wrong. I tested this with the following code:

function EA_GetMenuItems(MenuLocation, MenuName)
    if MenuName = "" then
        'Menu Header
        EA_GetMenuItems = "-&MyAddinMenu"
    else 
        if MenuName = "-&MyAddinMenu" then
            'Menu items
            Dim menuItems(1)
             menuItems(0) = "TreeViewMenu"
             menuItems(1) = "DiagramMenu"
             EA_GetMenuItems = menuItems 
         end if
    end if 
end function
jyt13 commented 1 year ago

I see this code also in your website, but it is in VB, I am using JScript. And because now the script I am working is quite big already and I know nothing of programming with VB, it is hard for me to change the language.

So, may I know, from a developer's point of view, it should be theoretically correct when here is an array of strings in the corresponding language, is it?