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!"
If Not oProjectData Is Nothing Then
MsgBox "Project Path: " & oProjectData.GetProjectFilePath, vbInformation, "Event:ProjectChanged fired!"
Hope it helps,
Finally, ProjectChanged is the solution for me.
Thanks for your help.