Book a Demo

Author Topic: Getting started with scripting  (Read 7432 times)

MMiletic

  • EA Novice
  • *
  • Posts: 16
  • Karma: +0/-0
    • View Profile
Getting started with scripting
« on: October 14, 2022, 07:27:00 pm »
Hello guys,

this is my first post, I am still getting started with EA (newbie). Do you have any recommendation which tutorial to use to start? I am good at C-family languages but still, I am unfamiliar with JScript, Javascript. VB is totally out of my scope. I need to make a script that will import CSV file and generate objects and diagrams out of it, but it will do it constantly because it should check changes in CSV file and edit model. I know it's not a simple job, but if you know anything that could help me to start, I would be grateful because all JScript tutorials are Web related, I didn't find info on Sparx sites either.

Thank you in advance for you help and answers!  :)

Geert Bellekens

  • EA Guru
  • *****
  • Posts: 13523
  • Karma: +574/-33
  • Make EA work for YOU!
    • View Profile
    • Enterprise Architect Consultant and Value Added Reseller
Re: Getting started with scripting
« Reply #1 on: October 14, 2022, 09:24:08 pm »
I have a bunch of example scripts in my github.
They are all VBScript, but there are a few that import CSV files.

See https://github.com/GeertBellekens/Enterprise-Architect-VBScript-Library/blob/c3354b3f49069d354aa862569cf0a70410524e5c/Projects/Project%20AC/Import%20Identifiers.vbs

Geert

qwerty

  • EA Guru
  • *****
  • Posts: 13584
  • Karma: +397/-301
  • I'm no guru at all
    • View Profile
Re: Getting started with scripting
« Reply #2 on: October 14, 2022, 09:45:24 pm »
Since you ask: My Scripting book was intended for people like you. See link below.

q.

MMiletic

  • EA Novice
  • *
  • Posts: 16
  • Karma: +0/-0
    • View Profile
Re: Getting started with scripting
« Reply #3 on: October 14, 2022, 11:01:48 pm »
Hello qwerty,

you mean this one? https://leanpub.com/ScriptingEA

I am interested, let me just ask you, because I am not sure from sample, is there explanation in JScript? Do you think that your book provides knowledge that will help me do as I previously described?

Best regards, M.

OpenIT Solutions

  • EA User
  • **
  • Posts: 555
  • Karma: +9/-1
    • View Profile
Re: Getting started with scripting
« Reply #4 on: October 15, 2022, 12:13:39 am »
Hi,

If you want to import CSV, you might also look at the Sparx DataMiner concept, here https://sparxsystems.com/enterprise_architect_user_guide/16.0/modeling_fundamentals/data_miner.html. I think it has out of the box connections for csv files + some examples.

You should also be aware of the CSV export/import feature - depending upon the specific details of your use case, this might fufill your requirements without having to write any code. See https://sparxsystems.com/enterprise_architect_user_guide/16.0/model_exchange/csvspecifications.html

Regards,

Jon.

Sunshine

  • EA Practitioner
  • ***
  • Posts: 1353
  • Karma: +121/-10
  • Its the results that count
    • View Profile
Re: Getting started with scripting
« Reply #5 on: October 15, 2022, 06:09:45 am »
There are examples of scripts in the script library of Sparx EA. Open up a model and via Special tab click on script library. In EAScriptLib you see JavaScript-CSV, JScript-CSV and VBScript-CSV scripts.
Noting that JavaScript appears to be the future direction for scripting in Sparx EA then that might be the language to use however some folk have found using COM objects for File Import/export has been problematic in Javascript.
There is an import/export CSV feature in Sparx under Publish tab but it will create new elements unless you have the GUID's in the CSV file. We use that and have JavaScript in an HTML page to merge two CSV files. One file is the new CSV file data and the other an export from Sparx EA. We then reimport the merged CSV file. Can dig it up if you want.
There is an MDG Integration for Office that imports Excel and provides synching with Excel. Costs some money.
Happy to help
:)

qwerty

  • EA Guru
  • *****
  • Posts: 13584
  • Karma: +397/-301
  • I'm no guru at all
    • View Profile
Re: Getting started with scripting
« Reply #6 on: October 15, 2022, 11:43:20 pm »
Hello qwerty,

you mean this one? https://leanpub.com/ScriptingEA

I am interested, let me just ask you, because I am not sure from sample, is there explanation in JScript? Do you think that your book provides knowledge that will help me do as I previously described?

Best regards, M.
Yes, that's the one. I have not used a specific language for several reasons. Hoewever, the notion is algorithmic C-based and you should be able to map it easily into any J-dialect. It's not a book to learn coding but for a coder who want's an easy entry to EA's API.

Anyway, Leanpub offers a full refund if you are not happy with the content.

q.
« Last Edit: October 15, 2022, 11:46:19 pm by qwerty »