4 Replies Latest reply on May 3, 2016 7:41 AM by christopher.branch

    can`t close DxDesigner /viewdraw at the end of script !




      I wanted to write a script which will exit the current runing designe. But if i run the  Quit method at the end of the scriptlines I geth this message:




      any Idea ?

      is this new in VX ?


      my script snipped


      Dim dxdapp, PrjData, PrjPath

      set dxdapp = Application                                                          


      dxdapp.Quit()                                            ' Close current xDxdesigner

        • 1. Re: can`t close DxDesigner /viewdraw at the end of script !

          If you could post the rest of your script, it would be helpful.  It's likely that you have a hook into something that you do not dispose of properly.  A view, doc, sheet, or something.  Normally you would use a command like


          object = Nothing


          to kill it after it's done being used, and before you attempt to close the application. The scripting engine can take care of some unhandled objects, but maybe not all. Have a look at that throughout your script and see if perhaps it makes a difference.

          • 2. Re: can`t close DxDesigner /viewdraw at the end of script !

            Hi Patrick,

            the script snipped above is everything I got. Then idea was to write a script which will close the current running DxD and after copy the Project.

            But i never came further because I didn’t even get the script to close the DxDesigner.

            What the code dose is gain access of the Designer and then just closes it.



            Option Explicit



            ' Initialize - Applications


            Dim dxdapp


            set dxdapp = Application                                 ' Gets the DxDesigner Application


            dxdapp.Quit()    ' Close current xDxdesigner

            • 3. Re: can`t close DxDesigner /viewdraw at the end of script !

              Here's how I'd do it.  I verified that it works without errors.  Note I use vb.net.  You may need to make minor adjustments if you use vbscript and/or EFM's.


              Public app as ViewDraw.Application

                   public doc as Object

                   public view as ViewDraw.IVdView

                   Public prj As ViewDraw.IProjectData



                   Public Sub DX_Connect()

                       on error goto exit_no_app


                       app = GetObject(,"ViewDraw.Application")

                       If app Is Nothing Then

                           goto exit_no_app

                       End If

                       doc = app.ActiveDocument

                       view = app.ActiveView

                       prj = app.GetProjectData



                   End Sub


                   Sub quit_and_kill()

                       prj = Nothing

                       view = Nothing

                       doc = Nothing


                       app = Nothing


              End Sub


              To attach to the currently running DxDesigner session, use DX_Connect.  Then to stop and kill it, use quit_and_kill.  I suppose you could put all this in one subroutine and do the copying or whatever between the prj = . . . and the prj = Nothing lines, but I prefer to keep them separate so that they can be called separately if needed by other routines.


              I think your error comes as a result of never using the app = GetObject(,"ViewDraw.Application") command.  The use of  set dxdapp = Application  is not correct and will not actually create a connection to the DXDesigner session. So when you try to quit, there is nothing there to quit.

              • 4. Re: can`t close DxDesigner /viewdraw at the end of script !

                Thanks for your help Patrick

                I still can`t close the dxdesigner throw script. But I think it is because I do not have a Automation Pro license.

                how I get it, it is just possible to access the script engines with this license


                Regards christopher