views:

27

answers:

0

I am using the following vbscript to automate AutoCAD

  Dim acadObj
  WScript.Timeout = 30000'
  set acadObj = GetObject(,"Autocad.Application")'
  If Err.Number <> 0 Then
    Set acadObj = CreateObject("Autocad.Application")
    aCadObj.Documents.Item(0).Close(false)
  End If
  acadObj.Visible = true
  Err.Clear()

What it should do is open a new instance of autocad if there is none, or get the first running instance of autoCad it can find if there is any.

While this works on Windows XP Sp3, it always opens new instances of AutoCAD on Windows 7.

Does the Windows Scripting Host behave differently on these to plattforms or did I overlook something else?