Jump to content

Recommended Posts

Posted

hi all,

how can I create batch file to open AutoCAD and run script ?

thanks for help

  • 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

Posted

You should use the "/b" start-up switch:

"C:\Program Files\AutoCAD 2012\acad.exe" /b "C:\MyScriptFiles\ScriptToRun.SRC"

Posted

MSasu

thank you so much I will try it but I prefer batch file.

Posted

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?

Posted

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.

Posted

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"

Posted

It looks like you are trying to open a "read-only" file and forgot the necessary input in your script.

Posted

I agree with ReMark. Your script is wrong somewhere. If you post it we may be able to help you out a bit more.

Posted

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

Posted

or this

_.open *1.dwg* (setvar 'ltscale 10.0) _.qsave _.close

Posted

Is the file saved in a read only location or do you have it open already?

Posted

No.

this file is saved in full control location.

Posted

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.

Posted

how could this method work with multiple file ?

Posted

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.

Posted

OK .

just copy your method in script file without any add as you wrote.

Posted

Tuns

I try it and it worked perfectly but I add qsave not save .

Thanks so much.The comments helped a lot.

Posted

thank you. ReMark.MSasu

Thanks a lot guys.

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...