Jump to content

create batch file to run script ?


mostafa badran

Recommended Posts

  • Replies 24
  • Created
  • Last Reply

Top Posters In This Topic

  • mostafa badran

    10

  • Tuns

    6

  • ReMark

    2

  • MSasu

    2

Top Posters In This Topic

Posted Images

You said: "how can I create batch file to open AutoCAD and run script?" MSasu's answer was correct. The batch file is used to open AutoCAD. Once AutoCAD is opened the script file is called. The script can process a single drawing or an entire folder of drawings. Is that what you want to do?

Link to comment
Share on other sites

You can also use this:

FOR %%V IN ([color="red"]C:\AutoCADscripts\Batchedit\[/color]*.dwg) DO start "T" /w "C:\Program Files\Autodesk\AutoCAD 2012\acad.exe" %%V /b "C:\AutoCADscripts\[color="red"]ScriptName[/color].scr"

You have to have the correct file path in the first portion in red so that it knows what folder to use the script on. Second part in red is the name of the script you want to run. Mwade showed this to me, but it works great. Just paste it into notepad and save it as a .bat file.

Link to comment
Share on other sites

Above all I salute you.

It is give me an error like attachment. Please take a look to batch syntax. Please tell me what's wrong.

thanks for your help.

11-11-2013 07-14-58 م.jpg

FOR %%V IN (D:\test\dwg\*.dwg) DO start "T" /w "C:\Program  Files\Autodesk\AutoCAD 2012 - English\acad.exe" %%V /b  "D:\test\script\test LTS - 2.scr"

Link to comment
Share on other sites

my script

OPEN
"D:\test\dwg\1.DWG"
ltscale
10
QSAVE
CLOSE
OPEN
"D:\test\dwg\2.DWG"
ltscale
10
QSAVE
CLOSE
OPEN
"D:\test\dwg\3.DWG"
ltscale
10
QSAVE
CLOSE

Link to comment
Share on other sites

Well if you're using my method of running a batch, which it looks like you are, you need to change your script to this:

ltscale
10
SAVE
QUIT  

Make sure you get the two blank spaces that come after the "QUIT" command. I don't know if your script is what is causing the problem, so try this and tell me if it works.

Link to comment
Share on other sites

Because, the method I gave you in post #6 uses the Command Prompt and not AutoCAD. It will run those 4 commands over and over until it has done it on all the files in the specified folder. Besides, if it didn't work, it would be less tedious to make a macro and go through each one individually than it would be to write all those lines over and over again.

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.


×
×
  • Create New...