Batch open dosomethin' close save

Batch open dosomethin' close save

Anonymous
Not applicable
315 Views
5 Replies
Message 1 of 6

Batch open dosomethin' close save

Anonymous
Not applicable
using A2k and VBA, I am looking for a study code scrap to:
batch cycle through about 50 dwg's in c:\xfile.
I want to open each dwg, shrink all the text by about 25%,
re-save each file and move to the next one without dismissing dialog
boxes.
I have the shrink text project in the help file, so my main question
is to do with a batch-open-do-something-then-save routine.
Thanks all,
jim kitts
0 Likes
316 Views
5 Replies
Replies (5)
Message 2 of 6

Anonymous
Not applicable
For starters, here's a few routines to help. Since a lot of people ask about
batch processing, I cobbled together a small batch processing hook. The way
it works is you pass it the firectory you want to process along with the
*.dwg filter: C:\myDir\*.dwg. In addition, you pass it the name of the
function that does the actual processing. In this case, dummy. The Batch
routine will find your files and pass them as argument to the dummy routine.
In this case, dummy just pops up a dialog saying what file it was given.
You, of course will make your rotuine much more useful. As for the saving
part, after you've processed your file, call ThisDrawing.Close True. Hope
this helps.

Public Sub Batch(filter As String, funcName As String)

Dim tmp As String

tmp = Dir$(filter)

Do While tmp <> ""
Eval funcName & " """ & tmp & """"
tmp = Dir$
Loop

End Sub

Public Sub dummy(dwg As String)

MsgBox "Found " & dwg

End Sub

Public Sub test()

Batch "C:\program files\mdt4\*.dwg", "dummy"

End Sub

--
Get free software and more at http://www2.stonemedia.com/franko

"Ruth Mitchell or Jim Kitts" wrote in message
news:[email protected]...
> using A2k and VBA, I am looking for a study code scrap to:
> batch cycle through about 50 dwg's in c:\xfile.
> I want to open each dwg, shrink all the text by about 25%,
> re-save each file and move to the next one without dismissing dialog
> boxes.
> I have the shrink text project in the help file, so my main question
> is to do with a batch-open-do-something-then-save routine.
> Thanks all,
> jim kitts
>
>
>
0 Likes
Message 3 of 6

Anonymous
Not applicable
Take a look at AXDB15.DLL. This one is installed with A2K and allows you to
access multiple drawings without opening them in the drawing editor.
Randall Rath did an article on this DLL in his A.C.A.D. newsletter back on
10/28/99. You can find it archived at:
http://afralisp.hypermart.net/rr/aoct28.htm Look about half way down the
page for sample code and some instructions.

==============================
Michael Weaver
Charles Bettisworth & Co.
[email protected]
==============================

"Ruth Mitchell or Jim Kitts" wrote in message
news:[email protected]...
> using A2k and VBA, I am looking for a study code scrap to:
> batch cycle through about 50 dwg's in c:\xfile.
> I want to open each dwg, shrink all the text by about 25%,
> re-save each file and move to the next one without dismissing dialog
> boxes.
> I have the shrink text project in the help file, so my main question
> is to do with a batch-open-do-something-then-save routine.
> Thanks all,
> jim kitts
>
>
>
0 Likes
Message 4 of 6

Anonymous
Not applicable
Thanks Frank!. I got a routine opening and closing.

If you are reading this, what does this do, and what are the " marks for?

Eval funcName & " """ & tmp & """"

jim kitts
0 Likes
Message 5 of 6

Anonymous
Not applicable
thanks Michael.

> AXDB15.DLL. looks like a good way to go.

jim kitts
0 Likes
Message 6 of 6

Anonymous
Not applicable
Eval takes a string that represents a function and it's arguments and
executes it. The extra quotes are to get quotes around the drawing name. For
the sake of argument, let's say that tmp is equal to C:\Temp\Sample.dwg.
That's what you would get if you printed it. But the dummy routine is
expecting to see it like this: "C:\Temp\Sample.dwg". So overall what the
Eval statement does is this:

dummy "C:\Temp\Sample.dwg"

Of course, now that you know how to get every drawing in a directory using
Dir$, you can just move that loop into your main code. But I'm a bit of a
geek when it comes to programming so I got a kick out making a callback
routine for batch processing.

--
Visit me at: http://www2.stonemedia.com/franko

"Ruth Mitchell or Jim Kitts" wrote in message
news:[email protected]...
> Thanks Frank!. I got a routine opening and closing.
>
> If you are reading this, what does this do, and what are the " marks for?
>
> Eval funcName & " """ & tmp & """"
>
> jim kitts
>
0 Likes