mostafa badran Posted November 9, 2013 Posted November 9, 2013 hi all, how can I create batch file to open AutoCAD and run script ? thanks for help Quote
MSasu Posted November 9, 2013 Posted November 9, 2013 You should use the "/b" start-up switch: "C:\Program Files\AutoCAD 2012\acad.exe" /b "C:\MyScriptFiles\ScriptToRun.SRC" Quote
mostafa badran Posted November 10, 2013 Author Posted November 10, 2013 MSasu thank you so much I will try it but I prefer batch file. Quote
MSasu Posted November 11, 2013 Posted November 11, 2013 Maybe I misunderstood your request; may want to check the ScriptPro tool instead? Quote
ReMark Posted November 11, 2013 Posted November 11, 2013 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? Quote
Tuns Posted November 11, 2013 Posted November 11, 2013 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. Quote
mostafa badran Posted November 11, 2013 Author Posted November 11, 2013 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. 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" Quote
ReMark Posted November 11, 2013 Posted November 11, 2013 It looks like you are trying to open a "read-only" file and forgot the necessary input in your script. Quote
Tuns Posted November 11, 2013 Posted November 11, 2013 I agree with ReMark. Your script is wrong somewhere. If you post it we may be able to help you out a bit more. Quote
mostafa badran Posted November 11, 2013 Author Posted November 11, 2013 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 Quote
mostafa badran Posted November 11, 2013 Author Posted November 11, 2013 or this _.open *1.dwg* (setvar 'ltscale 10.0) _.qsave _.close Quote
Tuns Posted November 11, 2013 Posted November 11, 2013 Is the file saved in a read only location or do you have it open already? Quote
mostafa badran Posted November 11, 2013 Author Posted November 11, 2013 No. this file is saved in full control location. Quote
Tuns Posted November 11, 2013 Posted November 11, 2013 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. Quote
mostafa badran Posted November 11, 2013 Author Posted November 11, 2013 how could this method work with multiple file ? Quote
Tuns Posted November 11, 2013 Posted November 11, 2013 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. Quote
mostafa badran Posted November 11, 2013 Author Posted November 11, 2013 OK . just copy your method in script file without any add as you wrote. Quote
mostafa badran Posted November 11, 2013 Author Posted November 11, 2013 Tuns I try it and it worked perfectly but I add qsave not save . Thanks so much.The comments helped a lot. Quote
mostafa badran Posted November 11, 2013 Author Posted November 11, 2013 thank you. ReMark.MSasu Thanks a lot guys. Quote
Recommended Posts
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.