1

I have to open a dwg and then execute an AutoCADLT command, immediately after the program load the file. I know that there is a switch to open a "script", but since the LT version of the program can't handle scripts, I'm wondering if there is a similar switch for commands.

To open my file I'm using this string:

"path-of-the-program\program.exe" path-of-the-dwg\file.dwg <CAD COMMAND>

but it doesn't work

Bob404
  • 11
  • 4

1 Answers1

2

The only method that I am aware of to facilitate the execution a command or set of commands on drawing startup without the use of an API (such as the AutoLISP API) is to use the acad.exe command line switch /b to open AutoCAD and run the Script file whose filename follows the /b switch.

I describe this briefly as part of my answer here, and there is also this off-site resource describing the various command-line switches available, which I will also summarise below:

Switch Syntax and Examples

  • /b

    Open a drawing and runs a Script. Drawing name is optional.

    path ["drawing file"] /b "script"
    "C:\AutoCAD 2002\acad.exe" /b "C:\scripts\MyScript"
    
  • /c

    Specifies the hardware configuration file to use.

    path /c "Configuration File"
    "C:\AutoCAD 2002\acad.exe" /c "C:\myconfigs\MyConfig" 
    
  • /nologo

    Starts AutoCAD without the splash screen.

    path  /nologo
    "C:\AutoCAD 2002\acad.exe" /nologo    
    
  • /p

    Starts AutoCAD with the specified Profile name. If the Profile does not exist, AutoCAD uses the current Profile.

    path  /b profile
    "C:\AutoCAD 2002\acad.exe" /p "C:\profiles\MyProfile" 
    
  • /r

    Resets all AutoCAD default settings, printers and system pointing device.

    path /r
    "C:\AutoCAD 2002\acad.exe" /r 
    
  • /s

    Designates additional Support Paths.

    path /s "Support Paths"
    "C:\AutoCAD 2002\acad.exe" /s "C:\Blocks;C:\Lisp;C:\VBA"  
    
  • /t

    Creates a new drawing based on a Template or Prototype drawing. Drawing name is optional.

    path  ["drawing file"] /t "Template File"
    "C:\AutoCAD 2002\acad.exe" /t "C:\MyTemplates\MyTemplate" 
    
  • /v

    Opens a drawing with a predefined view.

    path  ["drawing file"] /v "View Name"
    "C:\AutoCAD 2002\acad.exe" "MyDrawing" /v "MyView" 
    

You may also wish to refer to the official Autodesk documentation.

Whilst AutoCAD LT does support the use of Script files (.scr), such Script files will only be able to invoke native AutoCAD commands with no access to any AutoCAD API.

Lee Mac
  • 15,615
  • 6
  • 32
  • 80