I have several tasks I want to run in a project folder after that project is loaded into DxDesigner. Tasks: folder existence, content etc. This script will need be run from the scripts.ini file at startup and wait for the project to completely load.
Have you tried AfterDocumentOpened event?
Would you check ProjectChanged event.
Since you can get an event after project opened, please run a script after that.
ProjectChanged does not work for me. I never see it fired up
BeforeProjectChanged fired up too soon. ProjectData is not populated yet ...
ActivateView could be an alternative but happen too often (each time you switch between designa and let say startPage)
AfterDocumentOpened look like good candidate but I didn't get it work yet
Below example code is to show the project file path when opening a project, and show the document name when opening a document(schematic sheet).
Just save it into a file and include the file in scripts.ini (under [ViewDraw] section)
Call scripting.AttachEvents(Application, "myEvent")Scripting.DontExit = True
Sub myEvent_AfterDocumentOpened(enumDocumentType, sLibraryAlias, sDocName) If enumDocumentType = VDDT_SCHEMATIC Then MsgBox "Document Name: " & sDocName & vbCrLf & _ "Project Path: " & Application.GetProjectData.GetProjectFilePath, vbInformation, "Event:AfterDocumentOpened fired!" End If End Sub
Sub myEvent_ProjectChanged(oProjectData) If Not oProjectData Is Nothing Then MsgBox "Project Path: " & oProjectData.GetProjectFilePath, vbInformation, "Event:ProjectChanged fired!" End If End Sub
Hope it helps,
Finally, ProjectChanged is the solution for me.
Thanks for your help.
Retrieving data ...