AnsweredAssumed Answered

DxDesigner, ProjectData methods - How to update the application's internal state?

Question asked by beltz on Nov 2, 2016
Latest reply on Nov 2, 2016 by Patrick.Cashman

In xDX Designer Automation Reference, Project Data Object section (page 409).  It states that the ProjectData methods which modify project data ("modifier-methods") actually modify only the project file itself, so xDX Designer wouldn't be aware of these changes until it would read this project file.  Situations where project file contents are unsynchronized with the application's internal state could cause unexpected behavior.

 

I have a simple script which checks and sets the CL path in the .prj file to the correct value, when the project is opened in DxDesigner.  But as I understand from the above this only changes the value in the .prj file itself and not what is already loaded for the project in DxDesigner.    Is there a way to synchronize these using automation?

 

In my program currently, I just inform the user that the value has changed and that they should close the project and reopen the project in DxDesigner, for this change to take effect.

 

Option Explicit

 

' Run on an open document.

Dim vdapp

Set vdapp = GetObject (,"ViewDraw.Application")

 

' Get top level design name

Dim ProjectData, DesignName

Set ProjectData = vdapp.GetProjectData()

 

If Not (ProjectData.CentralLibraryPath = "/home/dms_lib/dms_lib.lmc") Then

  MsgBox("Warning: ****** Central Library path is being set to /home/dms_lib/dms_lib.lmc for this project.  You must close this project and reopen for this change to take effect. File>Close Project")

  ProjectData.CentralLibraryPath = "/home/dms_lib/dms_lib.lmc"

End If

 

Walt Beltz

Lexmark International Inc

Lexington, KY

Outcomes