Sparx Systems Forum

Enterprise Architect => Automation Interface, Add-Ins and Tools => Topic started by: Boron on July 30, 2013, 10:06:46 pm

Title: Use EA scripts stored in file outside the model
Post by: Boron on July 30, 2013, 10:06:46 pm
Hello,

I have a bunch of scripts (JScript) that I use to create some numbers I need for a report on the EA model.
Example: A script that finds all elements in a model with a special tagged value.

As we have many EA models I need to use the same scripts in all models.
I would like to have the script source codes stored outside the models on a network share or a version control repository.
But as far as I can see the scripts have to be stored "inside" the EA model (EA 9.3 menu View -> Scripting).

Is there a way to run scripts that are stored outside EA?
It is really annoying writing /extending/bugfixing a script in one model and deploy it to all other models.

Any idea is welcome.
Except for writing add-ins where we would need something like C# or Visual whatever ;).
Title: Re: Use EA scripts stored in file outside the mode
Post by: Geert Bellekens on July 30, 2013, 10:12:59 pm
Boron,

With add-ins you would have to distribute the new version to the different clients iso the different models.

You could of-course write an add-in to automatically update your scripts from a central location once you load a model...

Geert
Title: Re: Use EA scripts stored in file outside the mode
Post by: Boron on July 30, 2013, 10:30:02 pm
Your second points sound quite interesting.
So you say it is possible to have an mechanism that can import scripts and update the scripts stored inside the model?

Can you give me some hints or keywords for searching more info on this?
Thanks a lot.
Title: Re: Use EA scripts stored in file outside the mode
Post by: Geert Bellekens on July 30, 2013, 10:45:07 pm
That shouldn't be too hard no.

You just have to figure out where EA keeps the scripts (I'm guessing t_document ) and then compare the docdate with the modified date of your scrip on the shared drive.

If the docdate < modified date then just update the stringcontent and docdate.

Geert

(PS you can update the database from an add-in (or script) using the ondocumented and unsupported operation Repository.Execute())
Title: Re: Use EA scripts stored in file outside the mode
Post by: Boron on July 30, 2013, 10:52:13 pm
Thank you very much :).
This seems to be the way I need to go.
Title: Re: Use EA scripts stored in file outside the mode
Post by: qwerty on July 30, 2013, 10:52:59 pm
The scripts are in t_script. I'd be careful since EA might have to restart after a silent change. You better have a test before coding.

q.
Title: Re: Use EA scripts stored in file outside the mode
Post by: Boron on July 30, 2013, 11:08:37 pm
;) I would never test this on a "productive" model. That is why my local hard disk is filled with eap files for testing "things".
I am not very keen on being killed by my colleagues.
Title: Re: Use EA scripts stored in file outside the mode
Post by: qwerty on July 31, 2013, 01:13:23 am
I didn't think so :-) But you should test whether EA recognizes a modification of t_script under the hood with a rapid check.

q.
Title: Re: Use EA scripts stored in file outside the mode
Post by: Eve on July 31, 2013, 08:39:06 am
Scripts can be included in an MDG technology, which can then be shared by multiple users for any model they use.

Additionally, scripts can be exported as reference data. You can then configure that file to be automatically imported.