zoomwindow in vbscript

zoomwindow in vbscript

Anonymous
Not applicable
347 Views
4 Replies
Message 1 of 5

zoomwindow in vbscript

Anonymous
Not applicable
Hi,

Is it possible to use the zoomwindow method in a .vbs file?

I tried it, but when I execute the script I get the following error: 'Invalid argument LowerLeft in ZoomWindow.'

Any help would be appreciated 🙂
Hielke
0 Likes
348 Views
4 Replies
Replies (4)
Message 2 of 5

Anonymous
Not applicable
Can you paste the code that is in the vbs file? I have done some work with AutoCAD and vbs and found it to be very particular about how arguments are passed. I needed to use CreateTypedArray for pretty much everything that is an array of some kind that gets passed as an argument. "hielke" wrote in message news:10100048.1080218731263.JavaMail.jive@jiveforum2.autodesk.com... > Hi, > > Is it possible to use the zoomwindow method in a .vbs file? > > I tried it, but when I execute the script I get the following error: 'Invalid argument LowerLeft in ZoomWindow.' > > Any help would be appreciated :) > Hielke
0 Likes
Message 3 of 5

Anonymous
Not applicable
Hi,

Here is a part of the code.

grtz,
Hielke

'----------------------
Dim Acad
Dim ie
ReDim point1(2)
ReDim point2(2)

point1(0) = CDbl(19.8161): point1(1) = CDbl(19.7178): point1(2) = CDbl(0.000)
point2(0) = CDbl(20.6464): point2(1) = CDbl(20.1051): point2(2) = CDbl(0.000)

On error resume next
'Get AutocadObject.
Set Acad = GetObject(,"Autocad.Application.16")

If (VarType(Acad) = 9) Then
Acad.WindowState = 2
Acad.Documents.Open("c:\tablet.dwg")
Acad.Visible = 1
Acad.Application.ZoomWindow point1, point2
MsgBox err.description
Set Acad = Nothing
else
MsgBox "Er is geen standaard viewer voor dit type bestand geregistreerd."
End If
'--------------------------
0 Likes
Message 4 of 5

Anonymous
Not applicable
Hi, Try this -- i used different var names, but you get the idea... Dim AcadObj Dim AcadDoc Dim AcadUtility set AcadObj = createobject("AutoCAD.Application.16") Set AcadDoc = AcadObj.ActiveDocument Set AcadUtility = AcadDoc.Utility acadobj.visible=true Dim Point1 Dim Point2 AcadUtility.CreateTypedArray Point1, vbDouble, 19.8161,19.7178,0 AcadUtility.CreateTypedArray Point2, vbDouble, 20.6464,20.1051,0 AcadObj.Application.ZoomWindow point1, point2 --- hope this helps. "hielke" wrote in message news:12578652.1080223423945.JavaMail.jive@jiveforum1.autodesk.com... > Hi, > > Here is a part of the code. > > grtz, > Hielke > > '---------------------- > Dim Acad > Dim ie > ReDim point1(2) > ReDim point2(2) > > point1(0) = CDbl(19.8161): point1(1) = CDbl(19.7178): point1(2) = CDbl(0.000) > point2(0) = CDbl(20.6464): point2(1) = CDbl(20.1051): point2(2) = CDbl(0.000) > > On error resume next > 'Get AutocadObject. > Set Acad = GetObject(,"Autocad.Application.16") > > If (VarType(Acad) = 9) Then > Acad.WindowState = 2 > Acad.Documents.Open("c:\tablet.dwg") > Acad.Visible = 1 > Acad.Application.ZoomWindow point1, point2 > MsgBox err.description > Set Acad = Nothing > else > MsgBox "Er is geen standaard viewer voor dit type bestand geregistreerd." > End If > '--------------------------
0 Likes
Message 5 of 5

Anonymous
Not applicable
Hi Tim,

I tried your code and it works!

Thanks a lot, I saves me a lot of time.

Grtz,
Hielke
0 Likes