Book a Demo

Author Topic: Difference between "normal" script execution and debug execution?  (Read 3120 times)

rwittmann

  • EA Novice
  • *
  • Posts: 14
  • Karma: +0/-0
    • View Profile
Difference between "normal" script execution and debug execution?
« on: September 27, 2023, 10:09:23 pm »
Hello,

What is the difference between a script execution in EA between executing the script normally (e.g. for a project explorer script this is right click on element in project explorer->Scripts->ScriptName) and the debug execution of the script (by opening the script in EA, select the appropriate element in the project explorer and click on the "Play" button above the script.

There seems to be a difference because the same script runs perfectly when launching it via the Play button, but will stop at a certain line when executing it from the project explorer. It will always stop on the same line, at least printf-debugging leads to that assumption.
The "faulty" line is the following:

sourceObj = sequence.GetDiagramObjectByID(sourceElement.ElementID, null);

sourceElement.ElementID is a valid ID, and will be printed out when iterating over all DiagramObjects via sequence.DiagramObjects.GetAt(j)

The workaround is obviously iterating over the DiagramObjects and finding the correct Element. But I'd like to understand what could be the difference here...




Geert Bellekens

  • EA Guru
  • *****
  • Posts: 13523
  • Karma: +574/-33
  • Make EA work for YOU!
    • View Profile
    • Enterprise Architect Consultant and Value Added Reseller
Re: Difference between "normal" script execution and debug execution?
« Reply #1 on: September 27, 2023, 11:34:36 pm »
One of the differences is that the debug mode ignores the setting option explicit for VBScript.

So a script could work just fine when debugging, but fail when executing normally.

There are two "play" buttons on top of the script. Before pushing your script to your production model, you should make sure to execute it using the left "Run Script" button.

Geert