Book a Demo

Author Topic: Example script not working - what's wrong with it?  (Read 3438 times)

mmo

  • EA User
  • **
  • Posts: 85
  • Karma: +0/-0
    • View Profile
Example script not working - what's wrong with it?
« on: July 20, 2014, 06:57:09 pm »
BTW: the script I was trying to debug (see my other thread) is the VBS example that comes with EA, which can be found via Tools => Scripting => (Scripts Tab)  LocalScripts => "VBScript - Project Interface Example".

From reading the source code I had expected, that this script would dump all diagrams of a project into the temp directory as .emf files (which is exactly what I was I had been considering to script, so I was very delighted to find that script).  :'( :'(

But, alas, that script does "nothing", i.e. it runs through but does not create a single .emf file, even though my project contains multiple diagrams.

What is wrong with this example script?

Regards,
M. :'(

« Last Edit: July 20, 2014, 08:08:47 pm by mmo »

mmo

  • EA User
  • **
  • Posts: 85
  • Karma: +0/-0
    • View Profile
Re: Example script not working - what's wrong with
« Reply #1 on: July 20, 2014, 08:08:17 pm »
Apologies!
The script works! It's only fault is, that is assumes that all diagrams are direct children of packages, while in my project, all diagrams are underneath their corresponding classes.

setting the top-level for-loop to read
Code: [Select]
     dim childElement as EA.Element
      for each childElement in currentModel.Elements
            DumpDiagrams childElement
      next
instead of
Code: [Select]
     dim childPackage as EA.Package
      for each childPackage in currentModel.Packages
            DumpDiagrams childPackage
      next
and then also adapting all types underneath made my diagrams appear, i.e. being written out :D!

Sorry for the bandwidth consumed!
M.