Author Topic: Get details (ID) from the current script  (Read 562 times)

Guillaume

  • EA User
  • **
  • Posts: 587
  • Karma: +18/-0
    • View Profile
    • www.umlchannel.com
Get details (ID) from the current script
« on: January 04, 2018, 05:28:37 pm »
Hi,

I'd like to call a common function where the expected argument is the script ID (as per t_script.scriptid).
It doesn't seem to be possible to dynamically retrieve such information for the running script. Am I missing something or do we need a new Repository.GetCurrentScriptID method in the API?

Thanks
Guillaume

Blog: www.umlchannel.com | Free utilities addin: www.eautils.com | Automated tests for scripts & addins: www.eatests.com

Geert Bellekens

  • EA Guru
  • *****
  • Posts: 8027
  • Karma: +183/-21
  • Make EA work for YOU!
    • View Profile
    • Enterprise Architect Consultant and Value Added Reseller
Re: Get details (ID) from the current script
« Reply #1 on: January 04, 2018, 06:12:09 pm »
No, I think it is indeed not possible.

But given the fact that scripts are not in the API at all I highly doubt whether Sparx will be willing to implement such a feature.
I can imagine that they would reason that there is only a very limited number of users that would benefit from such a feature.

Geert

Guillaume

  • EA User
  • **
  • Posts: 587
  • Karma: +18/-0
    • View Profile
    • www.umlchannel.com
Re: Get details (ID) from the current script
« Reply #2 on: January 05, 2018, 06:48:41 pm »
It would be useful for those who write and maintain scripts.
For instance gathering the current script name could also be useful to have a generic/universal session.output call such as " Session.Output Now & currentScript.Name & " INFO message...."

I found a workaround by adding fake scripting ids via constants in a common file.

FYI, I have a number of scripts that prompt the user to select a destination or source folder with the files to process (e.g. Excel export or import). To save time, I'm storing in EA t_xref the selected folder for each script so the user can keep or modify it, hence the need to know the script id.

Guillaume

Blog: www.umlchannel.com | Free utilities addin: www.eautils.com | Automated tests for scripts & addins: www.eatests.com