Sparx Systems Forum
Enterprise Architect => Automation Interface, Add-Ins and Tools => Topic started by: Jayson on September 01, 2014, 11:00:51 am
-
Hi all
I have been feverishly scripting away over the last couple of weeks creating scripts that take a lot of the heavy lifting out of the work my end users have to do.
Now....I want to include these scripts in my MDG and make them available for the users to execute.
However, when I include my scripts in the MDG, all it does for me is include the script in the scripts tab, which has a number of undesirable effects:
1. The users have to know to open the script table.
2. They have to run the script, and
3. They can see the script and potentially modify it causing havoc.
What I was actually hoping to do is add a nice pretty menu group with menu options inside that they can execute the scripts from there and of course restrict who can run which scripts.
But....I can't seem to find this.
Any help gratefully received!
Jays :)
Btw, I am running version 9.3 in the meantime :(
-
The only way you can achieve what you want it to compile the scripts and bind them via a DLL. Sure it would be nice to have some protected scripting area for MDGs, but there isn't any.
Ask skiwi about the success factor of writing feature requests.+
q.
-
Partial solution maybe to make the scripts available as
[highlight]Project Browser Scripts[/highlight]
Create a new script group as Project Browser scripts and move / copy paste the scripts to this new group
Users should then be able to right-click on any element in the project browser where they will see a Scripts menu with all your scripts listed
This does address the restricting scripts to certain users, but may help in preventing users changing the scripts and also make them more readily available
Not sure if Project Browser scripts are in version 9.1, but its is worth a try
Cheers
Phil
-
I can add project browser scripts to a project, but what about an MDG?
When I add scripts to an MDG, it doesn't ask me what type of script I'd like it to be (i,e, project browser, etc..)
Cheers :)
-
I never use it, but there are some threads talking about this (where Helmut Ortmann replied). IIRC the scripts can not be added to a certain group when put in a MDG.
q.
P.S. http://www.sparxsystems.com/cgi-bin/yabb/YaBB.cgi?num=1404908061/0#0
-
Hi all,
Scripts can be exported to an MDG Technology. They then land in their own script group, where they can be viewed but not modified -- although they can of course be copied / pasted into new scripts, so if you want to restrict functionality for security reasons rather than convenience, security mechanisms written into a script are trivial to bypass.
It is not possible to export project browser or diagram scripts: they end up in the same group as other scripts and do not show up in the project browser / diagram "Scripts" context menu. These context menus have no submenus; all project browser / diagram scripts are flattened into a single menu regardless of which group they might belong to.
What I usually do in this situation is write my scripts as sets of functions which take as arguments model elements of the appropriate type (package, element, etc), export them, and then in the target projects write project browser / diagram scripts which wrap these library script functions.
This way I can develop and maintain the meat of the scripts in my MDG Technology project, and only need to maintain the wrappers, which are essentially clones of each other, in the target project.
Cheers,
/Uffe
-
Thanks for that Uffe!
Its not what I was hoping for, but at least now I know.
Btw, I have been trying to refactor my scripts as functions but the interpreter keeps bitching at me (see my other open question that I started yesterday).
Can you offer a code snippet on how to declare/call a function like this?
Cheers
Jays :)
-
Just a thought for a work around. Once you've got your scripts in the MDG you could write an install type script to copy them into the model under a project browser group or diagram group. So all your users or you have to do is run the install script to copy the scripts from the MDG and put them under the appropriate group to be used via the project browser or diagram etc.
Well that is the theory let us know how the practice goes.