Sparx Systems Forum

Enterprise Architect => Automation Interface, Add-Ins and Tools => Topic started by: Jamo on July 17, 2020, 06:16:07 pm

Title: Custom Dialog Window from Script
Post by: Jamo on July 17, 2020, 06:16:07 pm
Hi all,

I recently started to work with VB scripts to create elements in requirement diagrams and thanks to the examples present in EA itself this worked fine so far.

What I would like to do now, is having a custom dialog window open up, whenever I call the script so I can enter data like Name, Alias or Notes in one go (or rather with multiple input lines available).

I'm already using the VB native InputBox and I know that I could use it as a workaround by passing all data in just one line. I was just wondering if it is possible to create custom dialog windows in EA and call them from a script.

Best,
Jamo
Title: Re: Custom Dialog Window from Script
Post by: Geert Bellekens on July 17, 2020, 06:49:38 pm
Hi Jamo,

No not really.
There are workarounds, bu they all require quite a bit of work

- C# You could create a library in C#, and register that for COM such that it opens a custom dialog, allows user to enter stuff, and that returns stuff to your script. If this is register in COM you can call it using CreateObject() like you would instantiate any other .net class such as an ArrayList, Dictionary, XML parser etc.. I have used this method in the past to access the classes in my own framework library.

- I think you should be able to create a html form as well, show that, and then get the entered fields from that. I haven't looked in it any further, so for now this is entirely theoretical. If this works that would mean you could simply include all code in the script, without having to register anything in COM or similar.

Geert
Title: Re: Custom Dialog Window from Script
Post by: Jamo on July 17, 2020, 11:51:14 pm
Hey Geert,

thanks for the quick reply! Then I guess for now, I'll deal with this by using one or more input boxes one after the other.

Regarding the html form: Do you happen to know how to create a html file from a script within EA? I checked the documentation a bit but couldn't find any hint. I did find out that, for example, XML files can be created with CreateObject() and such, so I suppose it might work similarly. Just need to find the correct commands.

Best,
Jasper
Title: Re: Custom Dialog Window from Script
Post by: Geert Bellekens on July 18, 2020, 12:30:52 am
I'm not sure if there's a html equivalent of the xml objects, but you can surely create a text file from script with the required html code.

Geert
Title: Re: Custom Dialog Window from Script
Post by: bkone on July 23, 2020, 06:42:06 pm
Hello Jamo,

it could work like described in the link, second example.
https://www.robvanderwoude.com/vbstech_ui_userinput.php (https://www.robvanderwoude.com/vbstech_ui_userinput.php)
I want to try it myself as I need multi-value-input from the user and don't want to open a row of input boxes.


Best regards

Boris
Title: Re: Custom Dialog Window from Script
Post by: bkone on July 23, 2020, 06:50:15 pm
The HTA (HTML applications) feature seems to be lost with the move to Edge (Windows 10).

https://stackoverflow.com/questions/30975195/will-microsoft-edge-and-windows-10-support-hta