Jump to content
Sign in to follow this  
WashCaps37

AutoCAD Scripts

Recommended Posts

WashCaps37

Hello All -

I am new to this scripting so please forgive me. I am trying create a script that will eventually run an AutoCAD Script file but I keep running into an AutoIT Error message that states: Unable to execute the external program. The system cannot find the path specified. I have the correct path in the *au3 file. Does anyone know what I am doing wrong on this line of the script? (see below)

run("L:\\Cad_Library\Bonus_Tools\Scripts\Cycle Layouts.scr")

Any and all help is greatly appreciated!

Share this post


Link to post
Share on other sites
Andre

hi, as far as i know can Run only work with .exe .cmd .bat files.........

Andre


What about Windows without using AutoIt ?It would be the same as driving a car without an steering Wheel!

Share this post


Link to post
Share on other sites
phillip123adams

Hello All -

I am new to this scripting so please forgive me. I am trying create a script that will eventually run an AutoCAD Script file but I keep running into an AutoIT Error message that states: Unable to execute the external program. The system cannot find the path specified. I have the correct path in the *au3 file. Does anyone know what I am doing wrong on this line of the script? (see below)

run("L:\\Cad_Library\Bonus_Tools\Scripts\Cycle Layouts.scr")

Any and all help is greatly appreciated!

<{POST_SNAPBACK}>

AutoCAD Scripts run only from within AutoCAD or on the command line for AutoCAD. Within AutoCAD, use the SCRIPT command, or run it using AutoLisp by issuing the following on the AutoCAD command line or from within an AutoLisp file (double backslashes for all backslashes).

(command "script" "L:\\Cad_Library\\Bonus_Tools\\Scripts\\Cycle Layouts.scr")

Phillip

Share this post


Link to post
Share on other sites
WashCaps37

Do you have any suggestions/ideas on how I would be able to get this to work (execute the *.scr file) from a *.au3 script file?

Edited by WashCaps37

Share this post


Link to post
Share on other sites
WashCaps37

I guess I could convert it to an AutoLISP and try and execute it from the *au3 file. Would the "Send" command work in this case?

Share this post


Link to post
Share on other sites
phillip123adams

Do you have any suggestions/ideas on how I would be able to get this to work (execute the *.scr file) from a *.au3 script file?

<{POST_SNAPBACK}>

As this is a topic chiefly about AutoCAD, this is not the proper forum. Since it is also about the AutoIt Run function, it probably belongs in the "v3 Support" forum. If you need additional help, you should repost there, or in the Chat forum, or you could PM me.

Do you mean you want to start AutoCAD and have it immediately run a script? If so, add the /b option to the AutoCAD command line (the Target in the AutoCAD icon). For example to run AutoCAD and the AutoCAD script from an AutoIT3 script, do the following (Use single backslashes on the command line and note the use of single and double quotes):

Run('"C:\Program Files\AutoCad 2005\acad.exe" /b "L:\Cad_Library\Bonus_Tools\Scripts\Cycle Layouts.scr"')

There may be other switches on your command line. If so, keep them and add the /b switch to the end.

From the AutoCAD help file (search for /B):

The /b switch designates a script to run after AutoCAD starts. To invoke a script when you start AutoCAD, use the following syntax:

acad [drawing file]/b script

The script file must be listed after the /b switch on the command line; an SCR file type is assumed. If AutoCAD can't find the script file, it reports that it can't open the file.

Scripts can be used to set up drawing parameters in a new drawing file. For example, the following command creates a new drawing called widget and runs the script called setup.scr:

acad widget /b setup

When the script has finished, the Command prompt is displayed.

You must be very familiar with the sequence of AutoCAD prompts to provide an appropriate sequence of responses in a script file.

Note: AutoCAD prompts and command names may change in future releases, so you may need to revise your scripts when you upgrade. It is recommended that you avoid using abbreviations.


Phillip

Share this post


Link to post
Share on other sites
fi3l2

there is a way to run an .au3 script with another script

instead of using the Run() function

make the script goto start , run, enter in the path, then press enter

it works for me example

Send("#r")
WinWaitActive("Run")
Send($program & "{Enter}")

this works for me, hopefully it will help you

Share this post


Link to post
Share on other sites
WashCaps37

Thanks fi3l2! I'll give it a try when I get an opportunity.

Share this post


Link to post
Share on other sites
WashCaps37

Thanks phillip! I'll give it a try when I get a free moment. I'll PM you or repost in the Support Forum if I need any additional help. This was my first post and I didn't know if this was the right forum to post my question, so I apologize for the mix up.

Thanks again!

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this  

×